RE: Create a missing Workflow History List
No problems. Just remember that you can have as many history/task lists as you need and it is usually a good idea to have seperate ones if you expect a workflow to generate a large number of history/tasks. Regards, Paul Turner Senior Solutions Specialist M: 0412 748 168 P: 08 8238 0912 F: 08 8234 5966 A: 66 Henley Beach Road, Mile End SA 5031 E: paul.tur...@dws.com.au<mailto:paul.tur...@dws.com.au> W: www.dws.com.au<https://webmail.dws.com.au/owa/UrlBlockedError.aspx> ADVANCED BUSINESS SOLUTIONS LTD This email and any files transmitted with it are confidential and are only for the use of the person to whom they are addressed. If you are not the intended recipient you have received this email in error and are requested to delete it immediately. Any opinion expressed in this e-mail may not necessarily be that of DWS Pty Ltd. Please consider the environment before printing this email. From: ozmoss-boun...@ozmoss.com [ozmoss-boun...@ozmoss.com] On Behalf Of Ajay [akhanna...@gmail.com] Sent: Tuesday, 11 May 2010 9:14 AM To: ozMOSS Subject: Re: Create a missing Workflow History List Thanks Paul, I found there is feature for Workflow history list and I used that to create the list SPWeb.Lists.Add("Workflow History", "Workflow History Via Code.", "WorkflowHistory", "00BFEA71-4EA5-48D4-A4AD-305CF7030140", 140, "101"); Cheers A On Mon, May 10, 2010 at 4:25 PM, Paul Turner mailto:paul.tur...@dws.com.au>> wrote: This code does it. If your running SharePoint 2010 (Visual Studio 2010) you can get similar code if you create a new Assocaition form (using the VS 2010 templates for SharePoint). ''' ''' Creates the assocation. ''' ''' The current list. ''' Private Function CreateAssocation(ByVal currentList As SPList) As String Dim newTemplate As SPWorkflowTemplate = currentList.ParentWeb.WorkflowTemplates(New Guid(Me.m_WorkflowDefinition)) Dim currentWeb As SPWeb = currentList.ParentWeb ' Create the task list and history list. Dim workflowHistory As SPList Dim workflowTasks As SPList Try If (IsGuid(Me.m_HistoryList)) Then workflowHistory = currentWeb.Lists(New Guid(Me.m_HistoryList)) Else workflowHistory = currentWeb.Lists(Me.m_HistoryList) End If Catch ex As ArgumentException ' Replace the "z" with the workflow name. Me.m_HistoryList = Me.m_HistoryList.Replace("z", "") ' Create the list. Dim historyListId As Guid = currentWeb.Lists.Add(Me.m_HistoryList, String.Empty, SPListTemplateType.WorkflowHistory) workflowHistory = currentWeb.Lists(historyListId) End Try Try If (IsGuid(Me.m_TaskList)) Then workflowTasks = currentWeb.Lists(New Guid(Me.m_TaskList)) Else workflowTasks = currentWeb.Lists(Me.m_TaskList) End If Catch ex As ArgumentException ' Replace the "z" with the workflow name. Me.m_TaskList = Me.m_TaskList.Replace("z", Me.m_WorkflowName + " ") ' Create the list. Dim taksListId As Guid = currentWeb.Lists.Add(Me.m_TaskList, String.Empty, SPListTemplateType.Tasks) workflowTasks = currentWeb.Lists(taksListId) End Try currentWeb.Dispose() currentList.ParentWeb.Dispose() Dim newAssociation As SPWorkflowAssociation = SPWorkflowAssociation.CreateListAssociation(newTemplate, Me.m_WorkflowName, workflowTasks, workflowHistory) Dim addedAssociation As SPWorkflowAssociation = currentList.AddWorkflowAssociation(newAssociation) Return addedAssociation.Id.ToString End Function Regards, Paul Turner Senior Solutions Specialist M: 0412 748 168 P: 08 8238 0912 F: 08 8234 5966 A: 66 Henley Beach Road, Mile End SA 5031 E: paul.tur...@dws.com.au<mailto:paul.tur...@dws.com.au> W: www.dws.com.au<https://webmail.dws.com.au/owa/UrlBlockedError.aspx> ADVANCED BUSINESS SOLUTIONS LTD This email and any files transmitted with it are confidential and are only for the use of the person to whom they are addressed. If you are not the intended recipient you have received this email in error and are requested to delete it immediately. Any opinion expressed in this e-mail may not necessarily be that of DWS Pty Ltd. Please consider the environment before printing this email. From: ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com> [ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com>] On Behalf Of Paul Noone [paul.no...@ceosyd.catholic.edu.au<mailto:paul.no...@ceosyd.catholic.edu.au>] Sent: Monday, 10 May 2010 12:10 PM To: ozMOSS Subject: RE: Create a missing Workflow History List The provisioning code for this all exists within the site definition Publishing with Workflow. Hopefully you can use some of that. The feature activation should be simple enough. Good luck! From: ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun..
Re: Create a missing Workflow History List
Thanks Paul, I found there is feature for Workflow history list and I used that to create the list SPWeb.Lists.Add("Workflow History", "Workflow History Via Code.", "WorkflowHistory", "00BFEA71-4EA5-48D4-A4AD-305CF7030140", 140, "101"); Cheers A On Mon, May 10, 2010 at 4:25 PM, Paul Turner wrote: > This code does it. If your running SharePoint 2010 (Visual Studio 2010) > you can get similar code if you create a new Assocaition form (using the VS > 2010 templates for SharePoint). > > > > *''' * > > *''' Creates the assocation.* > > *''' * > > *''' The current list.* > > *''' * > > Private Function CreateAssocation(ByVal currentList As SPList) As String > > Dim newTemplate As SPWorkflowTemplate = > currentList.ParentWeb.WorkflowTemplates(New Guid(Me.m_WorkflowDefinition)) > > Dim currentWeb As SPWeb = currentList.ParentWeb > > *' Create the task list and history list.* > > Dim workflowHistory As SPList > > Dim workflowTasks As SPList > > Try > > If (IsGuid(Me.m_HistoryList)) Then > > workflowHistory = currentWeb.Lists(New Guid(Me.m_HistoryList)) > > Else > > workflowHistory = currentWeb.Lists(Me.m_HistoryList) > > End If > > Catch ex As ArgumentException > > *' Replace the "z" with the workflow name.* > > Me.m_HistoryList = Me.m_HistoryList.Replace("z", "") > > *' Create the list.* > > Dim historyListId As Guid = currentWeb.Lists.Add(Me.m_HistoryList, > String.Empty, > SPListTemplateType.WorkflowHistory) > > workflowHistory = currentWeb.Lists(historyListId) > > End Try > > Try > > If (IsGuid(Me.m_TaskList)) Then > > workflowTasks = currentWeb.Lists(New Guid(Me.m_TaskList)) > > Else > > workflowTasks = currentWeb.Lists(Me.m_TaskList) > > End If > > Catch ex As ArgumentException > > *' Replace the "z" with the workflow name.* > > Me.m_TaskList = Me.m_TaskList.Replace("z", Me.m_WorkflowName + " ") > > *' Create the list.* > > Dim taksListId As Guid = currentWeb.Lists.Add(Me.m_TaskList, String.Empty, > SPListTemplateType.Tasks) > > workflowTasks = currentWeb.Lists(taksListId) > > End Try > currentWeb.Dispose() > > currentList.ParentWeb.Dispose() > > Dim newAssociation As SPWorkflowAssociation = > SPWorkflowAssociation.CreateListAssociation(newTemplate, Me.m_WorkflowName, > workflowTasks, workflowHistory) > > Dim addedAssociation As SPWorkflowAssociation = > currentList.AddWorkflowAssociation(newAssociation) > > Return addedAssociation.Id.ToString > > End Function > > * > > Regards, > > > > Paul Turner > Senior Solutions Specialist > > M: 0412 748 168 P: 08 8238 0912 F: 08 8234 5966 > A: 66 Henley Beach Road, Mile End SA 5031 > E: paul.tur...@dws.com.au W: > www.dws.com.au<https://webmail.dws.com.au/owa/UrlBlockedError.aspx> > > [image: dws logo] > ADVANCED BUSINESS SOLUTIONS LTD > > This email and any files transmitted with it are confidential and are only > for the use of the person to whom they are addressed. If you are not the > intended recipient you have received this email in error and are requested > to delete it immediately. Any opinion expressed in this e-mail may not > necessarily be that of DWS Pty Ltd. > Please consider the environment before printing this email. > * > -- > *From:* ozmoss-boun...@ozmoss.com [ozmoss-boun...@ozmoss.com] On Behalf Of > Paul Noone [paul.no...@ceosyd.catholic.edu.au] > *Sent:* Monday, 10 May 2010 12:10 PM > *To:* ozMOSS > *Subject:* RE: Create a missing Workflow History List > >The provisioning code for this all exists within the site definition > Publishing with Workflow. Hopefully you can use some of that. The feature > activation should be simple enough. > > > > Good luck! > > > > *From:* ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] *On > Behalf Of *Ajay > *Sent:* Monday, 10 May 2010 12:33 PM > *To:* ozMOSS > *Subject:* Re: Create a missing Workflow History List > > > > Yes, I ams doing more investigation and you are right, that workflow > history list will be created by enabling a workflow. > > > > I want to do same process in code, as there are many many sub-sites and > telling client to do this in all the Pages Library will be nightmare. > > > > > > > > On Mon, May 10, 2010 at 2:27 PM, Paul Noone < > paul.no...@ceosyd.catholic.edu.au> wrote: > > I could be wrong but I believe the only difference be
RE: Create a missing Workflow History List
This code does it. If your running SharePoint 2010 (Visual Studio 2010) you can get similar code if you create a new Assocaition form (using the VS 2010 templates for SharePoint). ''' ''' Creates the assocation. ''' ''' The current list. ''' Private Function CreateAssocation(ByVal currentList As SPList) As String Dim newTemplate As SPWorkflowTemplate = currentList.ParentWeb.WorkflowTemplates(New Guid(Me.m_WorkflowDefinition)) Dim currentWeb As SPWeb = currentList.ParentWeb ' Create the task list and history list. Dim workflowHistory As SPList Dim workflowTasks As SPList Try If (IsGuid(Me.m_HistoryList)) Then workflowHistory = currentWeb.Lists(New Guid(Me.m_HistoryList)) Else workflowHistory = currentWeb.Lists(Me.m_HistoryList) End If Catch ex As ArgumentException ' Replace the "z" with the workflow name. Me.m_HistoryList = Me.m_HistoryList.Replace("z", "") ' Create the list. Dim historyListId As Guid = currentWeb.Lists.Add(Me.m_HistoryList, String.Empty, SPListTemplateType.WorkflowHistory) workflowHistory = currentWeb.Lists(historyListId) End Try Try If (IsGuid(Me.m_TaskList)) Then workflowTasks = currentWeb.Lists(New Guid(Me.m_TaskList)) Else workflowTasks = currentWeb.Lists(Me.m_TaskList) End If Catch ex As ArgumentException ' Replace the "z" with the workflow name. Me.m_TaskList = Me.m_TaskList.Replace("z", Me.m_WorkflowName + " ") ' Create the list. Dim taksListId As Guid = currentWeb.Lists.Add(Me.m_TaskList, String.Empty, SPListTemplateType.Tasks) workflowTasks = currentWeb.Lists(taksListId) End Try currentWeb.Dispose() currentList.ParentWeb.Dispose() Dim newAssociation As SPWorkflowAssociation = SPWorkflowAssociation.CreateListAssociation(newTemplate, Me.m_WorkflowName, workflowTasks, workflowHistory) Dim addedAssociation As SPWorkflowAssociation = currentList.AddWorkflowAssociation(newAssociation) Return addedAssociation.Id.ToString End Function Regards, Paul Turner Senior Solutions Specialist M: 0412 748 168 P: 08 8238 0912 F: 08 8234 5966 A: 66 Henley Beach Road, Mile End SA 5031 E: paul.tur...@dws.com.au<mailto:paul.tur...@dws.com.au> W: www.dws.com.au<https://webmail.dws.com.au/owa/UrlBlockedError.aspx> ADVANCED BUSINESS SOLUTIONS LTD This email and any files transmitted with it are confidential and are only for the use of the person to whom they are addressed. If you are not the intended recipient you have received this email in error and are requested to delete it immediately. Any opinion expressed in this e-mail may not necessarily be that of DWS Pty Ltd. Please consider the environment before printing this email. From: ozmoss-boun...@ozmoss.com [ozmoss-boun...@ozmoss.com] On Behalf Of Paul Noone [paul.no...@ceosyd.catholic.edu.au] Sent: Monday, 10 May 2010 12:10 PM To: ozMOSS Subject: RE: Create a missing Workflow History List The provisioning code for this all exists within the site definition Publishing with Workflow. Hopefully you can use some of that. The feature activation should be simple enough. Good luck! From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of Ajay Sent: Monday, 10 May 2010 12:33 PM To: ozMOSS Subject: Re: Create a missing Workflow History List Yes, I ams doing more investigation and you are right, that workflow history list will be created by enabling a workflow. I want to do same process in code, as there are many many sub-sites and telling client to do this in all the Pages Library will be nightmare. On Mon, May 10, 2010 at 2:27 PM, Paul Noone mailto:paul.no...@ceosyd.catholic.edu.au>> wrote: I could be wrong but I believe the only difference between the two site definitions is that one activates the publishing feature (and publishing approval workflows) on certain libraries. I also believe that the Workflow History list will be created when you add a particular workflow to a list by simply enabling approval and/or possibly any other workflow. Regards, Paul Online Developer, ICT CEO Sydney From: ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com> [mailto:ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com>] On Behalf Of Ajay Sent: Monday, 10 May 2010 12:13 PM To: ozMOSS Subject: Create a missing Workflow History List Hi Guys, In one of our applications we have chosen the template Publishing sites NOT the good one Publishing sites with workflow . Now we want to have workflows in this and I came across this good article. http://sharepointroot.com/2008/05/27/fix-sharepoint-workflows-after-deactivate/ this can help us but for one thing.. the subsites do not have "Workflow History" list. Task now is to create the workflow History. I noticed there is a feature in 12 Hive C:\Program Files\Common
RE: Create a missing Workflow History List
The provisioning code for this all exists within the site definition Publishing with Workflow. Hopefully you can use some of that. The feature activation should be simple enough. Good luck! From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of Ajay Sent: Monday, 10 May 2010 12:33 PM To: ozMOSS Subject: Re: Create a missing Workflow History List Yes, I ams doing more investigation and you are right, that workflow history list will be created by enabling a workflow. I want to do same process in code, as there are many many sub-sites and telling client to do this in all the Pages Library will be nightmare. On Mon, May 10, 2010 at 2:27 PM, Paul Noone mailto:paul.no...@ceosyd.catholic.edu.au>> wrote: I could be wrong but I believe the only difference between the two site definitions is that one activates the publishing feature (and publishing approval workflows) on certain libraries. I also believe that the Workflow History list will be created when you add a particular workflow to a list by simply enabling approval and/or possibly any other workflow. Regards, Paul Online Developer, ICT CEO Sydney From: ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com> [mailto:ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com>] On Behalf Of Ajay Sent: Monday, 10 May 2010 12:13 PM To: ozMOSS Subject: Create a missing Workflow History List Hi Guys, In one of our applications we have chosen the template Publishing sites NOT the good one Publishing sites with workflow . Now we want to have workflows in this and I came across this good article. http://sharepointroot.com/2008/05/27/fix-sharepoint-workflows-after-deactivate/ this can help us but for one thing.. the subsites do not have "Workflow History" list. Task now is to create the workflow History. I noticed there is a feature in 12 Hive C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES\WorkflowHistoryList\ I thought that activating this feature will install the list on the sites, but it does not.. can it be that it installs list template not the instance. Is there any way we can create the list using this feature... or any other help / pointers appreciated. Cheers Ajay ___ ozmoss mailing list ozmoss@ozmoss.com<mailto:ozmoss@ozmoss.com> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss ___ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
Re: Create a missing Workflow History List
Yes, I ams doing more investigation and you are right, that workflow history list will be created by enabling a workflow. I want to do same process in code, as there are many many sub-sites and telling client to do this in all the Pages Library will be nightmare. On Mon, May 10, 2010 at 2:27 PM, Paul Noone < paul.no...@ceosyd.catholic.edu.au> wrote: > I could be wrong but I believe the only difference between the two site > definitions is that one activates the publishing feature (and publishing > approval workflows) on certain libraries. > > > > I also believe that the Workflow History list will be created when you add > a particular workflow to a list by simply enabling approval and/or possibly > any other workflow. > > > > Regards, > > Paul > > Online Developer, ICT > CEO Sydney > > > > *From:* ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] *On > Behalf Of *Ajay > *Sent:* Monday, 10 May 2010 12:13 PM > *To:* ozMOSS > *Subject:* Create a missing Workflow History List > > > > Hi Guys, > > > > In one of our applications we have chosen the template Publishing sites NOT > the good one Publishing sites with workflow . > > > > Now we want to have workflows in this and I came across this good article. > > > > > http://sharepointroot.com/2008/05/27/fix-sharepoint-workflows-after-deactivate/ > > > > > this can help us but for one thing.. the subsites do not have "Workflow > History" list. > > > > Task now is to create the workflow History. > > > > I noticed there is a feature in 12 Hive > > > > C:\Program Files\Common Files\Microsoft Shared\Web Server > Extensions\12\TEMPLATE\FEATURES\WorkflowHistoryList\ > > > > I thought that activating this feature will install the list on the sites, > but it does not.. can it be that it installs list template not the instance. > > > > Is there any way we can create the list using this feature... or any other > help / pointers appreciated. > > > > Cheers > > Ajay > > ___ > ozmoss mailing list > ozmoss@ozmoss.com > http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss > > ___ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
RE: Create a missing Workflow History List
I could be wrong but I believe the only difference between the two site definitions is that one activates the publishing feature (and publishing approval workflows) on certain libraries. I also believe that the Workflow History list will be created when you add a particular workflow to a list by simply enabling approval and/or possibly any other workflow. Regards, Paul Online Developer, ICT CEO Sydney From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of Ajay Sent: Monday, 10 May 2010 12:13 PM To: ozMOSS Subject: Create a missing Workflow History List Hi Guys, In one of our applications we have chosen the template Publishing sites NOT the good one Publishing sites with workflow . Now we want to have workflows in this and I came across this good article. http://sharepointroot.com/2008/05/27/fix-sharepoint-workflows-after-deactivate/ this can help us but for one thing.. the subsites do not have "Workflow History" list. Task now is to create the workflow History. I noticed there is a feature in 12 Hive C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES\WorkflowHistoryList\ I thought that activating this feature will install the list on the sites, but it does not.. can it be that it installs list template not the instance. Is there any way we can create the list using this feature... or any other help / pointers appreciated. Cheers Ajay ___ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss