none
problem with Assigning Task form workflow to group of users RRS feed

  • Question

  • Hi All
    in my workflow I have tried to assign task to group created in sharepoint and apply permissions on it.as follwing:
    the first one is createTask_Event Handler and the second function is to set the permissions
      private void createTask_HRTask_MethodInvoking(object sender, EventArgs e)
            {
    
                _HRUserName = GetUserToApprove(1);
                createTask_HRTask_TaskId = Guid.NewGuid();
              
             
                //we need to update permissions on item to be assigned to creator and first one to approve
                SPWeb myWeb = new SPSite(workflowProperties.SiteId).
                                           OpenWeb(workflowProperties.WebId);
                SPListItem myItem = myWeb.Lists[workflowProperties.ListId].GetItemById(workflowProperties.ItemId);
                //let Creator View item
                CreatePermissions(myWeb, myItem, _ServerName + @"/" + ApplicantUserName, "ItemViewr", "FormCreatorNotFinishedWF");
                //Approver Permission
                CreatePermissions(myWeb, myItem,
                 _HRUserName, "Approver View", "Approver View");
    
                CreatePermissions(myWeb, myItem,
                  _HRUserName, "Approver View", "Approver View");
    
                
                this.createTask_HRTask_TaskProperties.Title = "Approve or reject Advance on salary request for :" + EmployeeName;
    
                this.createTask_HRTask_TaskProperties.SendEmailNotification = true;
    
    
    
    
                this.createTask_HRTask_TaskProperties.AssignedTo = _HRUserName;
                this.createTask_HRTask_TaskProperties.TaskType = 0;
                setTaskPermissions(createTask_HRTask_SpecialPermissions, this.createTask_HRTask_TaskProperties.AssignedTo);
    
    
    
    
            }
      private void setTaskPermissions(HybridDictionary boundDictionary, string sTaskOwner)
            {
    
                boundDictionary.Clear();
    
                boundDictionary.Add(sTaskOwner, SPRoleType.Contributor);
    
                boundDictionary.Add("NT AUTHORITY\\authenticated users", SPRoleType.Reader);
    
            }
    this task is assigned to group successully, but when one of  group users tries to open this task, gots an error that "Value doesnt fall withen expected rang".

    Any one have idea about this issue,
    Thanks.

    P.S. in my code insted of assigneg task to group of users, I assign it to one user and things go well


    just .. feel it
    Tuesday, April 21, 2009 6:49 AM

All replies