That is how it's supposed to work.

Thanks, Ishai Sagi
Extelligent Design
www.extelligentdesign.com<http://www.extelligentdesign.com>
Sent from my phone
+61 488 789 786

On 19/12/2011, at 14:41, "Ajay" 
<akhanna...@gmail.com<mailto:akhanna...@gmail.com>> wrote:

Thanks All,

It has worked by :--

Using ElevatedPriveleges and Adding the Pool account for this web application 
as Term Store Administrator.

I hope this is acceptable, I have not added Pool Acc from the Central Admin, 
but from Site Settings of the web application


Cheers,
A

On Mon, Dec 19, 2011 at 1:36 PM, James Boman 
<james.bo...@ipmo.com.au<mailto:james.bo...@ipmo.com.au>> wrote:
As others have mentioned – passing the current user token into the SPSite 
constructor while Elevating is probably not the best idea.
IMHO - If you are going pass a user token to the SPSite constructor it should 
be:

SPContext.Current.Site.SystemAccount.UserToken

Which is what we usually do this instead of Elevating – as the 
“RunWithElevatedPrivileges” is an expensive COM call, that can leak memory (at 
least in 2007).  In our team the rule is you only use 
“RunWithElevatedPrivileges” if you are trying to make off-box connections, or 
messing with Farm Properties etc.

The other obvious thing to consider with custom workflow activities is that 
from a security point of view they should ideally be registered in the 
web.config:

      <WorkflowService Assembly="Your.Assembly, Version=1.0.0.0, 
Culture=neutral, PublicKeyToken=1234567890123456" 
Class="Your.Assembly.ActivityService" />

Also consider adding your assembly (and any extra assemblies it loads) to the 
configuration/System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes 
section.

There are also extra considerations with workflow activities when you have a 
App Server in the farm that does NOT run the WFE role.

Good Luck,
               James.

________________________________
James Boman  ■ Telephone: +61 (08) 7200 
1100<tel:%2B61%20%2808%29%207200%201100> ■ Mobile: +61 (0) 417 857 
298<tel:%2B61%20%280%29%20417%20857%20298> ■ Web: 
http://www.ipmo.com.au<http://www.ipmo.com.au/> || 
http://www.projectserver.com.au<http://www.projectserver.com.au/>

From: ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com> 
[mailto:ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com>] On Behalf 
Of Ishai Sagi
Sent: Saturday, 17 December 2011 9:09 AM
To: ozMOSS
Subject: RE: Custom Workflow Activity

That code doesn’t really elevate privilages – either the token or the 
“RunWithElevatedPrivileges” is redundant. I think the problem will be in the 
“CreateTerm” function. If you share that with us we may see the cause of the 
issue.


<image003.jpg>Ishai Sagi | Solutions Architect
0488 789 786 | is...@exd.com.au<mailto:is...@exd.com.au> | 
www.sharepoint-tips.com<http://www.sharepoint-tips.com/> | 
@ishaisagi<http://twitter.com/ishaisagi>

From: ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com> 
[mailto:ozmoss-boun...@ozmoss.com]<mailto:[mailto:ozmoss-boun...@ozmoss.com]> 
On Behalf Of Ajay
Sent: Friday, 16 December 2011 5:49 PM
To: ozMOSS
Subject: Fwd: Custom Workflow Activity

I have discovered it's permission issue when workflow starts automatically.
I have elevated priveleges and also opened the site using token of admin 
account stil no luck.
See my code below
SPUser user = web.AllUsers["mydomain\\sharePoint_admin"];
SPUserToken token = user.UserToken;
SPSecurity.RunWithElevatedPrivileges(delegate()

{
using (SPSite site = new SPSite(siteCollection.ID, token))

{

CreateTerm(site, title);

}

});

---------- Forwarded message ----------
From: Ajay <akhanna...@gmail.com<mailto:akhanna...@gmail.com>>
Date: Fri, Dec 16, 2011 at 7:11 PM
Subject: Custom Workflow Activity
To: ozMOSS <ozmoss@ozmoss.com<mailto:ozmoss@ozmoss.com>>

Hi Guys,

I have created a custom WF activity hooked up in SharePoint designer.
It creates a sub-site and some user groups.

So far so good, then the requirement came to add the site name to the Term 
Store.

The workflow is configured to start on Item Added.

On Automatic start, problem is the workflow just creates the sub-site, does not 
create the term store entry and shows status as Cancelled.
When I manually start this workflow, than everything is fine, it creates site, 
adds term store entry and shows Status as Completed.
I ran a debugger stepped through the code all works fine.

What can be the reason for this.. is it permissions / identity issue when it 
runs manually opposed to automatic workflow start.

Cheers,
A


_______________________________________________
ozmoss mailing list
ozmoss@ozmoss.com<mailto:ozmoss@ozmoss.com>
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss


_______________________________________________
ozmoss mailing list
ozmoss@ozmoss.com<mailto:ozmoss@ozmoss.com>
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

<<inline: image003.jpg>>

_______________________________________________
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to