Share a Record to The Specific Team In MS CRM 2011 using C# Code

Share a Record to The Specific Team In MS CRM 2011 using C# Code

For.eg. to share a incident record to a team

//Paste the Below code in your plugin or any custompage

private void ShareRecordToBuTeam(IOrganizationService service, string SharedRecordEntitySchemaName, Guid SharedRecordGuid , string TeamLogicalName,Guid TeamGuid)
{
GrantAccessRequest grantShareingRequest = new GrantAccessRequest()
{
Target = new EntityReference(SharedRecordEntitySchemaName,SharedRecordGuid),
PrincipalAccess = new PrincipalAccess()
{
Principal = new EntityReference(TeamLogicalName,TeamGuid),
AccessMask = AccessRights.ReadAccess
}
};
GrantAccessResponse AccessResponse = (GrantAccessResponse)service.Execute(grantShareingRequest);
}

//Pass the parameter to the Function as below

Need

ShareRecordToBuTeam(service,”<entity Logical Name>”,<SharedRecordGUID>, “<team logical name>”,<TeamGuid>);

 

Cheers,

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s