views:

10

answers:

0

Hi all,

I'm developing an custom activity in sequential workflow.This activity's responsibility is get users (from AD) then add one or more user to sharepoint group on a specified site collection. But at runtime, I'm getting a problem like this. Please, see my code snippet.

try

{

SPGroup spGroup;

web.AllowUnsafeUpdates = true; //site.CatchAccessDeniedException = false;

spGroup = web.SiteGroups[groupName];

spGroup.AddUser(userName, string.Empty, string.Empty, string.Empty);

spGroup.Update();

web.Update();

} catch (Exception ex) { //do something } finally { web.AllowUnsafeUpdates = false; //site.CatchAccessDeniedException = true; }

At firs time

-Run workfow with this activity, see these users added by this code snippet. -Remove manually these users. At second time

-Run this workflow with this activity again, do not see anylonger. -Did IISRESET and everything but still not.

After, I do not run this workflow and wait for it around a quite long time (not remember exactly much but quite long) and run this workflow again and it worked for me.

I think this controlled by some service (Timer job or something). I was wondering why we add by manually, these shown immediately but do this by code, this happen. My code snippet getting problem. So, anybody please help me ?

Thanks in advance. -StandleyNguyen-

related questions