17.2.15

SharePoint App Dev Note


##Grab the cert and create the object##
$publicCertPath = "C:\vca-share.cer"
$certificate = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($publicCertPath)
##Certificate treated as root authority##
New-SPTrustedRootAuthority -Name "HighTrustAppCert" -Certificate $certificate
##Setup token issuer which is the certificate itself##
$realm = Get-SPAuthenticationRealm
$specificIssuerId = [System.Guid]::NewGuid().ToString()
$specificIssuerId
$fullIssuerIdentifier = $specificIssuerId + '@' + $realm
New-SPTrustedSecurityTokenIssuer -Name "HighTrustAppCert" -Certificate $certificate -RegisteredIssuerName $fullIssuerIdentifier -IsTrustBroker
iisreset
$serviceConfig = Get-SPSecurityTokenServiceConfig
$serviceConfig.AllowOAuthOverHttp = $true
$serviceConfig.Update()
$specificIssuerId


http://{sharepoint}/_layouts/15/AppRegNew.aspx


New-SPSubscriptionSettingsServiceApplication -ApplicationPool "SharePoint Web Services Default" -Name "Subscription Settings Service Application" -DatabaseName "SubscriptionSettingsDB" | New-SPSubscriptionSettingsServiceApplicationProxy

New-SPSubscriptionSettingsServiceApplication -ApplicationPool "SharePoint Web Services Default" -Name "Subscription Settings Service Application" -DatabaseName "SubscriptionSettingsDB" | New-SPSubscriptionSettingsServiceApplicationProxy

New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck" -Value "1" -PropertyType dword

 
$serviceConfig = Get-SPSecurityTokenServiceConfig$serviceConfig AllowOAuthOverHttp = $true $serviceConfig.Update()

http://sharepoint.stackexchange.com/questions/79284/getting-401-403-in-high-trust-app-for-sharepoint-2013

system.net tag:
<settings>
<servicePointManager
 checkCertificateName=”false”
 checkCertificateRevocationList=”false”/>
</settings>


8.12.14

SharePoint - JavaScript current page context info

var _spPageContextInfo = {
   2:     webServerRelativeUrl: "\u002ftest",
   3:     webAbsoluteUrl: "http:\u002f\u002fexample\u002ftest",
   4:     siteAbsoluteUrl: "http:\u002f\u002fexample.com\u002ftest",
   5:     serverRequestPath: "\u002f_layouts\u002f15\u002fosssearchresults.aspx",
   6:     layoutsUrl: "_layouts\u002f15",
   7:     webTitle: "Home",
   8:     webTemplate: "53",
   9:     tenantAppVersion: "0",
  10:     webLogoUrl: "_layouts\u002f15\u002fimages\u002fsiteicon.png",
  11:     webLanguage: 1033,
  12:     currentLanguage: 1033,
  13:     currentUICultureName: "en-US",
  14:     currentCultureName: "en-US",
  15:     clientServerTimeDelta: new Date("2013-06-07T19:07:01.3494510Z") - new Date(),
  16:     siteClientTag: "40$$15.0.4420.1017",
  17:     crossDomainPhotosEnabled: false,
  18:     webUIVersion: 15,
  19:     webPermMasks: {
  20:         High: 2147483647,
  21:         Low: 4294967295
  22:     },
  23:     pagePersonalizationScope: 1,
  24:     userId: 1,
  25:     systemUserKey: "i:0\u0029.w|s-1-5-21-...",
  26:     alertsEnabled: false,
  27:     siteServerRelativeUrl: "\u002ftest",
  28:     allowSilverlightPrompt: 'True'
  29: };

example, open current page's version history:

open content editor web part and past this:

<script>function openModal(){var options = {    tite: "Version History",    url: _spPageContextInfo.webServerRelativeUrl + "/_layouts/Versions.aspx?list="+ _spPageContextInfo.pageListId +"&ID="+ _spPageContextInfo.pageItemId,    width: 800,    height: 500,};SP.UI.ModalDialog.showModalDialog(options);}</script><a href="javascript:openModal()">open</a>




Name
SP2010
SP2013
Example Value
currentLanguage
X
X
1033
pageItemId
X
X
1
pageListId
X
X
Guid
webLanguage
X
X
1033
webServerRelativeUrl
X
X
/
webUIVersion
X
X
4 or 15
alertsEnabled
X
X
False
allowSilverlightPrompt
X
X
False
userId
X
X
9
clientServerTimeDelta

X
Time
crossDomainPhotosEnabled

X
False
currentCultureName

X
en-US
currentUICultureName

X
en-US
layoutsUrl

X
_layouts/15
pagePersonalizationScope

X
1
serverRequestPath

X
/SitePages/Home.aspx
siteAbsoluteUrl

X
http://sp
siteClientTag

X
0$$15.0.4420.1017
siteServerRelativeUrl

X
/
systemUserKey

X
1:0).w|<sid>
tenantAppVersion

X
0
webAbsoluteUrl

X
http://sp
webTemplate

X
1
webLogoUrl

X
_layouts/15/images/siteicon.png
webPermMasks

X
Object with properties
High & Low
webTitle

X
Test