SPAppPrincipalPermissionsManager.AddSiteSubscriptionPermission method (SPAppPrincipal, Guid, Byte[])
Grants the app principal access to a site subscription-scoped (also called tenant-scoped) permission for a specified workload and specified permission provider.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
Public Sub AddSiteSubscriptionPermission ( _
appPrincipal As SPAppPrincipal, _
providerTypeId As Guid, _
permission As Byte() _
)
'Usage
Dim instance As SPAppPrincipalPermissionsManager
Dim appPrincipal As SPAppPrincipal
Dim providerTypeId As Guid
Dim permission As Byte()
instance.AddSiteSubscriptionPermission(appPrincipal, _
providerTypeId, permission)
public void AddSiteSubscriptionPermission(
SPAppPrincipal appPrincipal,
Guid providerTypeId,
byte[] permission
)
Parameters
appPrincipal
Type: Microsoft.SharePoint.SPAppPrincipalThe app principal to be granted access.
providerTypeId
Type: System.GuidThe GUID of the permission provider.
permission
Type: []The permissions to be granted.
Remarks
Note
For permission management of BCS, Search, Social, and Taxonomy, use the other overload of this method: AddSiteSubscriptionPermission(SPAppPrincipal, Guid, SPAppPrincipalPermissionKind)
The providerTypeId for all Project Server permission scopes is: 99dce5f7-7743-4b6d-89d4-5bfbbbc2ef63.
The permission parameter is a byte array equivalent of a value in the Right_DI_PJ14Mref enum. The following is an example of selecting the permissions and converting them to a byte array to be passed to this method.
AppPermissions[] perms = {AppPermissions.Right.Read, AppPermissions.Right.Write};
BinaryFormatter formatter = new BinaryFormatter();
var binStream = new MemoryStream()
formatter.Serialize(binStream, perms);
var permsAsByteArray = binStream.ToArray();
binStream.Dispose();
The following table shows the available permissions for the Project Server permission scopes.
Project Server Permission Scope URI |
Available Permissions |
---|---|
https://sharepoint/projectserver |
Manage |
https://sharepoint/projectserver/projects |
Read, Write |
https://sharepoint/projectserver/projects/project |
Read, Write |
https://sharepoint/projectserver/enterpriseresources |
Read, Write, BypassDelegate |
https://sharepoint/projectserver/statusing |
SubmitStatus |
https://sharepoint/projectserver/reporting |
Read |
https://sharepoint/projectserver/workflow |
Elevate |
See also
Reference
SPAppPrincipalPermissionsManager class
SPAppPrincipalPermissionsManager members