Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I need to fetch the OOB approval workflow from current web to associate it with my custom list

I tried to fetch it through BaseId but then i got to know that BaseId is not the same for different languages.

Is there any other way to fetch the OOB approval workflow's template for sites created on different languages?

I have also tried GetTemplateByName method but its returning null for any language other than English also.

web.WorkflowTemplates.GetTemplateByName("Approval - SharePoint 2010", CultureInfo.CurrentCulture)

Any help would be appreciated.

Thanks Sanjay

share|improve this question

1 Answer 1

I solved this problem myself.

As i mentioned in my question, the BaseId varies from language to language. After trying out different methods and googling it, i didn't find any solution to the problem, so i started investigating it myself.

During my investigation, I fetched the BaseId for approval workflow for different languages and soon a pattern emerged. It turned out that BaseId (Guid) is almost same for every language except last three digits and those three digits were basically hexadecimal representation of LCID !!

So, this is how template based id can be formed

string baseId = "8ad4d8f0-93a7-4941-9657-cf3706f00" + web.Language.ToString("X"); Guid workflowBaseId = new Guid(baseId);

so, once we have the base id, we can use the same method to retrieve the template: web.WorkflowTemplates.GetTemplateByBaseID(workflowBaseId);

I also wrote the blog post on this one here, in case you would like to see the entire piece of code for workflow association: http://sanjaybhagia.wordpress.com/2013/10/20/associating-oob-approval-workflow-with-custom-list-for-different-locale-lcids/

Hope it helps.

Regards, Sanjay

share|improve this answer
    
Do not only link to your own blog, write an abstract here aswell! Great you found you answer, but instead of focusing on driving traffic to your blog, try to help others :) –  Robert Lindgren Oct 20 '13 at 17:05
    
Also, since you have used a URL shortener, the link will break in time, leaving the answer not helpful at all –  Robert Lindgren Oct 20 '13 at 17:06
1  
Hej Robert, my intention was not to drive any traffic to my blog :) I thought it will be better to point to the description solution right away but I can put up the response here as well, if it seems inappropriate :) Thanks for pointing it out. –  Sanjay Bhagia Oct 20 '13 at 17:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.