Paylasma (Share)
public static void Share(string principalName, Guid _principalId, string targetName, Guid _targetId, IOrganizationService serv)
{
GrantAccessRequest grantAccessRequest = new GrantAccessRequest
{
PrincipalAccess = new PrincipalAccess
{
Principal = new EntityReference(principalName, _principalId),
AccessMask = AccessRights.ReadAccess | AccessRights.WriteAccess | AccessRights.ShareAccess | AccessRights.AssignAccess | AccessRights.AppendAccess | AccessRights.AppendToAccess
},
Target = new EntityReference(targetName, _targetId)
};
GrantAccessResponse grantAccessResponse=(GrantAccessResponse)serv.Execute(grantAccessRequest);
}
}
Paylasımı Kaldırma (UnShare)
public static Result UnShare(string principalName, Guid _principalId, string targetName, Guid _targetId, IOrganizationService serv)
{
RevokeAccessRequest revokeAccessRequest = new RevokeAccessRequest
{
Revokee = new EntityReference(principalName, _principalId),
Target = new EntityReference(targetName, _targetId)
};
RevokeAccessResponse revokeaccessresponse = (RevokeAccessResponse)serv.Execute(revokeAccessRequest);
}
Eski Paylasımı Guncelleme(Modify)
public static void ModifyObject(EntityReference systemUser, EntityReference account, IOrganizationService service)
{
PrincipalAccess principalAccess = new PrincipalAccess
{
AccessMask = (AccessRights)852023,
Principal = systemUser
};
ModifyAccessRequest modifyAcessRequest = new ModifyAccessRequest();
modifyAcessRequest.PrincipalAccess = principalAccess;
modifyAcessRequest.Target = account;
service.Execute(modifyAcessRequest);
}
Hiç yorum yok:
Yorum Gönder