GroupTask

Aug 6, 2009 at 7:47 AM

In a GroupTask, if setting ExecutionType to Sequence, how to determine the sequence order of the group reviewers? Thanks.

Coordinator
Aug 7, 2009 at 2:00 AM

the sequence is determine by the  order of the user in the group , In fact GroupTask do not case about the order of user.

 

SPGroup group = web.SiteGroups[roleName];
                if (group == null)
                    throw new SPException(String.Format("组[{0}]不存在或被删除", roleName));
                List<SPUser> users = new List<SPUser>();
                if (group.Users.Count == 0)
                    return users;
                if (group.Users.Count == 1)
                {
                    users.Add(group.Users[0]);
                    return users;
                }
                foreach (SPUser user in group.Users)
                {
                    if (user.LoginName.ToLower() != "sharepoint\\system") //排除系统管理员
                        users.Add(user);
                }

SPGroup group = web.SiteGroups[roleName];

List<SPUser> users = new List<SPUser>();

foreach (SPUser user in group.Users)

 {

           if (user.LoginName.ToLower() != "sharepoint\\system") 

                   users.Add(user);

 }

if you want to control the order of the user , you can use MulitTask , and the Initialized event of MultiTask , you can assign users by sequence , for example:

 void GroupTask1_Initialized(object sender, EventArgs e)

{

 GroupTask1.Users.Add("user1 loginName");

 GroupTask1.Users.Add("user2 loginName");

}

 

Aug 7, 2009 at 2:15 AM

it's great, thanks.