Sharepoint Desinger 2010 - Transfer Reusable Workflow from Stage to Prod - sharepoint

I need to transfer a reusable Workflow from the stage env. to the prod.
The workflow is associate to a list, so the list id is stored in the workflow.
Is it possible to transfer the workflow and change the list id to the list name with Visual Studio? (We have no SharePoint Designer access to the prod. env.)

Short answer: No
I tried several hours to fix a reusable workflow, which same as yours was associated with a specific list - I switched systems and the GUID changed --> Workflow was broken.
You can give it a try and rename the MyWorkflow.wsp to MyWorkflow.cab and extract that somewhere. The workflow files are XML based hence you can edit the associated list GUID with your favorite editor. Now you need to package your edited file back into a cab file, rename it to wsp and you can give it a shot. I tried exactly that and resented to just "re-clicking" (as it's SPD) my workflow (two screens come in handy here).
That's what I call "reusable" workflow... Next time do not associate your reusable workflow with anything to keep it reusable.

I would recommend creating an Content Type in a Feature and then base your list and your Reusable Workflow association on that Content Type. We had a project in December where we successfully used this method. I saved a Reusable Workflow as a template. I then deployed the Content Type solution package and the Workflow solution package to another environment. Worked like a charm.

There are tow alternatives for deploying workflow regardless the assigned content types
It is very simple just do the following:
Alternative One
Save the workflow as template
Go to the following path in your site
http://your_server_Address/SiteAssets/Forms/AllItems.aspx
Download the file as WSP
Go to the following URL
http://your_Target_server_Address/_catalogs/solutions/Forms/AllItems.aspx
Upload the WSP, and activate the solution
Go to the site settings, then Site Actions, then Manage site features
Activate the feature that is related to the workflow
If you click workflows under site administration you would be able to see your custom reusable workflow
Alternative Two
Save the workflow as template
Go to the following path in your site
http://your_server_Address/SiteAssets/Forms/AllItems.aspx
Download the file as WSP
Open your visual studio
Click add new project
Under SharePoint choose 2010
Choose Import reusable work flow
Follow the wizard
Project will be created and can be deployed
Note : Make sure your workflow is reusable and that it has no errors

Related

Is it possible to add workflow modification programmatically?

I`m interested in adding SharePoint Workflow Modification programmatically from my workflow, without using forms.
What i'm trying to achieve - I want to add Workflow modification when user uploads new document version to document library. I have OnWorkflowItemChanged and from there i'm willing to add WF Modification.
Is this possible?
To clarify some things:
I`m writing a custom Workflow in Visual Studio.
What I want is to add items to (SPWorkflowModificationCollection) SPWorkflow.Modifications object. However there is no Add method, but the designed way to add items there is by using Workflow Modification forms.
In this case, i don't want user to use modification form, but i want to add workflow modifications (which will populate the collection AND triger OnWorkflowModified event).
I am not 100% sure what you mean by workflow modification. Do you want to modify the workflow itself from a workflow or just modify a document or item from a SharePoint Workflow?
Regardless, I'll give you the same answer to what was accepted as the answer to a similar question.
Workflow is one of the strong parts of SharePoint. Out-of-the box you or your users can build workflows using the free SharePoint Designer. Depending on your exact requirements this may be good enough.
If you need a more advanced workflow editor then you may want to consider Nintex Workflow or K2. Alternatively you can write your own workflows in Visual Studio or buy 3rd part Workflow Actions for SharePoint Designer.
I have included some useful links below:
Building workflows using SharePoint Designer
Creating workflows using Visual Studio
3rd Part Workflow actions to embed VB or C# directly into SharePoint Designer Workflows. Note that I have worked on this product so consider my recommendation biased ;-)

Cannot associate a custom SharePoint Workflow with a Content Type in SharePoint Server 2010

To preface, I am working with SharePoint Server 2010 Beta 2, Visual Studio 2010 Ultimate RC.
I have built a custom Content Type based on the Item type with a few custom site columns. I also have built a custom Sequential Workflow using Visual Studio 2010. This is a relatively simple workflow that creates a task, waits for the task to complete, sets the workflow to complete. I am able to deploy this workflow to the site collection through VS 2010 deploy (which is pretty nice, btw). The problem I have is that when I try to associate the custom Content Type with my custom workflow, that workflow is not listed in the workflow templates to choose from. There are only the OOTB SharePoint workflows to choose. The kicker is that if I create a list and associate a workflow to that list, my custom workflow is in the workflow template list. This makes sense since at the start of building a custom workflow in VS2010, one of the first questions is whether the workflow is a Site or a List workflow and I selected List. Is the issue that List workflows are not allowed to be associated with Content Types?!?
Thanks.
In your workflow's elements.xml, look for AssociationCategories and change it to ContentType like so:
<AssociationCategories>ContentType</AssociationCategories>
Big thanks to my co-worker, Yves for pointing this out :)

Using WSPBuilder to build a solution for a web part I developed

I have only ever deployed web parts from development by clicking F5. Now, I know I have to have a manifest file, feature file, etc and it all goes into a wsp file. I understand the wsp file is what gets added to Central Admin.
So my problem is this. I have found lots of sites that show how to use WSP Builder, but they don't seem to show how/where I add my web part to the WSP Builder project. My understanding is that somehow I should be able to use WSP Builder to create a wsp file containing my already-developed web part.
There are only two approaches that I see would work.
I create a WSPBuilder project (like all the how-tos on WSPBuilder show), then I assume I would somehow add my web part to that project - although I don't know how.
In my web part project, create WSPBuilder -> Build WSP. I have done this, and when I run stsadm on the resulting wsp file, I get it in Central Admin, but its not added to my Site Collection Features or my Web Part Gallery.
Can someone please explain this to me like I am a 6 year old? If you point me to another site, there is a good chance I have already seen it, so then I would ask you point me to the specific lines that tell me how to get my already existing web part packaged into the wsp.
To create a new web part feature with WSPBuilder:
Right-click on the name of your WSPBuilder project in Visual Studioand click Add, New Item.
Select WSPBuilder from the tree on the left and choose Web Part Feature from the list on the right of the dialog.
Enter the title of the web part feature and click OK.
In the dialog that appears enter the title, description and scope and click OK.
Your feature will now be created. You will then need to merge your existing web part code into this feature and configure its XML files.
Read this walkthrough by Tobias Zimmergren for more information. There is another walkthrough here.
Alex, got the right path to solve it. I think the small exception here is that wrongly spelt Add New Item instead of New Project.

SharePoint Workflows - How to associate with specific content types (particularly folders)?

I noticed when working with SharePoint Designer that each workflow has a config xml with tags. Does anyone know how to:
1) Associate the workflow with a specific content type?
2) Know if it is possible to associate a workflow with folders?
It is possible to associate workflows with folders. Apparently Visual Studio created Windows Workflow Foundation (WWF) development is the only tried-and-true way to create custom workflows that can be associated with different content types. There are some enterprise tools that can help a lot for creating custom workflows such as K2's Blackpoint (though I haven't had a chance to try the software).
I did find a couple of other workflow tutorials to start me off:
SharePoint Workflows for Folder Content Type - codeproject.com
Microsoft SharePoint Team Blog
I didn't find any information on the config xml tags yet.

Sharepoint: Deploy Custom Lists and New Columns in lists

I've created a custom list & also added a column in the Announcement List. Question is, how can I include those newly created items when I create a fresh Web Application (like a script, feature or something)?
Additional Info: It's like when you're to deploy from your development machine to a staging or production server. I'd like to have a script or something to update my production server to have the new column i've added to the Announcement List. Just like SQL Server's ALTER TABLE command to update a SQL Server Table.
Is there an equivalent in Sharepoint Lists?
TIA!
Regarding the new custom list, this can be done using features. See How to: Create a Custom List Definition for more information. The Visual Studio Extensions for SharePoint (VS2005 / VS2008) will help you to extract the list definition if you've created it through the SharePoint UI. If you are fortunate enough to be using a custom site definition and don't have any webs created yet, you can set your site definition to create the custom list using feature stapling.
If you are attempting to apply these changes to webs that already exist, you can still use a feature to define your custom list. It will just appear as a type of list that can be created. Then to have the custom list automatically created for existing webs or to modify existing lists such as the Announcements list, you can use a feature receiver. This allows you to run any custom code when the feature is activated. See the MSDN article Feature Events for more information.
Alternatively, you could not use features at all as they can be difficult, time consuming and painful. In fact, this blog post has a good argument against the idea. You could try the tool mentioned on that page or other applications such as DocAve Content Manager and SharePoint Site Migration Manager.
Your question is not very clear but I think you may want to look at Application Templates.
Microsoft provide 40 pre-built templates in the link below and the same technology is available to you. Links from this page should lead you to information showing you how you can crate your own.
Application Templates for Windows SharePoint Services 3.0
http://technet.microsoft.com/en-us/windowsserver/sharepoint/bb407286.aspx

Resources