Hi,
I am trying to use the SpecialPermissions in CreateTask Activity. I am trying to set the custom role. The custom role exists in the site.
I have tried the below code:
private void createTaskforApprover_MethodInvoking(object sender, EventArgs e) { this.ApproverTaskId = Guid.NewGuid(); CreateTask taskForApprover = sender as CreateTask; using (SPSite oSite = new SPSite(workflowProperties.SiteId)) { using (SPWeb oWeb = oSite.OpenWeb(workflowProperties.WebId)) { oWeb.AllowUnsafeUpdates = true; SPRoleDefinition oSPRoleDefinition = oWeb.RoleDefinitions["customRoleName"]; taskForApprover.SpecialPermissions.Add("domain\userloginname, oSPRoleDefinition); oWeb.AllowUnsafeUpdates = false; } } }
There is value in the oSPRoleDefinition. I am getting the object reference error in the SpecialPermissions.Add.
How to fix this? How to add the custom role in special permissions?
Thanks