Change/Rename Reusable SharePoint workflow template title

When saving a template of SharePoint designer workflow, it creates a pretty ugly title including the site it was created and all. I wanted to change this title to make it standard as our other feature naming conventions:

For tools related to repackaging the wsp file, please see my earlier article Here.

1. Copied the "SiteApprovalWorkflow.wsp" to C:\mywork\workbench
2. Extracted the WSP file using 7-zip > content extracted to "C:\mywork\workbench\SiteApprovalWorkflow"
3. Opened the file "C:\mywork\workbench\SiteApprovalWorkflow\Site Approval WorkflowListInstances\Feature.xml" and edited the Title="Workflow template "Site Approval Workflow" from web template "Channel Home"" to Title="Readify.Pwcs.Collabration.TeamSiteApprovalWorkflow", save the file.
4. Copied the file "makeddf.exe" to "C:\mywork\workbench"
5. Opened a command prompt @C:\mywork\workbench>
6. Executed the command – makeddf /p SiteApprovalWorkflow /d SiteApprovalWorkflow.ddf /c SiteApprovalWorkflow.cab

MakeDDF 1.0.1 (r119) · http://www.Stum.de
_________________________________________
CAB Filename: SiteApprovalWorkflow.cab
Base Path: SiteApprovalWorkflow\
DDF File Name: C:\mywork\workbench\SiteApprovalWorkflow.ddf
Using Absolute Path names: no

Finished execution on 2015-03-12 12:08:51

MakeDDF 1.0.1 (r119) · http://www.Stum.de
_________________________________________
CAB Filename: SiteApprovalWorkflow.cab
Base Path: SiteApprovalWorkflow\
DDF File Name: C:\mywork\workbench\SiteApprovalWorkflow.ddf
Using Absolute Path names: no

Finished execution on 2015-03-12 12:08:51

7. Copy the newly created file "C:\mywork\workbench\SiteApprovalWorkflow.ddf" into "C:\mywork\workbench\SiteApprovalWorkflow" folder
8. cd C:\mywork\workbench\SiteApprovalWorkflow
9. makecab /f "SiteApprovalWorkflow.ddf"
10. file gets created at: "C:\mywork\workbench\SiteApprovalWorkflow.cab"
11. Rename that to .WSP

EDITING WSP FILES DIRECTLY / MANUALLY (Re-Packaging, makecab) – How To?

Exported site/web template could not be used to recreate the site:

Problem Applying Web Template

This web template requires that certain features be installed, activated and licensed. The following problems are blocking application of the template.

How to Fix?

  • EXTRACT THE WSP FILE

Download a tool like 7-Zip.
Right click the file
Select 7-Zip > Extract to WspName
Go ahead and go into the folders and edit any XML that you may need to. Using the example above you will need to edit the onet.xml file to remove the site collection feature reference.

Right click and extract the wsp file @ C:\Users\msmriyaz\Desktop\SPO-Backup level

  • BUILD THE DIRECTIVE FILE

Download makeddf and drop the makeddf.exe in the same directory as your extracted folder
Open command prompt
Change directory to the location of makeddf
Run the following command

makeddf /p WspName /d WspName.ddf /c WspName.cab

cd "C:\Users\msmriyaz\Desktop\SPO-Backup\SPO-Project Template v1.0"

makeddf.exe /p "SPO-Project Template v1.0" /d "SPO-Project Template v1.0.ddf" /c "SPO-Project Template v1.0.cab"

  • REMAKE THE CAB

Copy the newly created ddf file into your WspName folder

Go back to your command prompt

Change directory into the WspName folder

Run the following command

makecab /f WspName.ddf

Rename your newly created cab file to WspName.wsp and you’re done

Creating a Feature for the Site Actions Menu in SharePoint 2010

Overview

You can add a custom menu item to the default Site Actions menu in Microsoft Windows SharePoint Services by creating a Feature with a CustomAction element. In this way, you can add custom commands to the default SharePoint user interface. These commands are available to users as they move between pages on a SharePoint site. When you create a Site Actions menu item, you can configure it to redirect the user to any URL. For example, you can redirect the user to another Web site. You can also redirect users to a custom application page that allows them either to see a custom display of data, or to perform custom operations on the content within the current site.

Code It

  1. Create a new Project in VS 2010 and under SharePoint (left) select Empty Project.
  2. Now enter the url of your SharePoint site for debugging and select deploy as a farm solution.
  3. Now, once you have the project open, right click on the Feature folder and Add a new feature.
  4. SharePoint automatically adds a feature and names it as Feature1. You can however change the feature name to something like CustomActionFetaure.
  5. With this you will have a feature designer opened in front of you set the Title description and scope of the feature.
  6. Now right click on the Project and add a new Item. In the Add New Item dialog, select Empty Element to create a blank element file.
  7. Add the below Code to the element.xml file.

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <CustomAction
    Id="viewSiteManager"
    GroupId="SiteActions"
    Location="Microsoft.SharePoint.StandardMenu"
    Sequence="1000"
    Rights="ViewListItems,ManageAlerts" Title="Manage Content and Structure" Description="Reorganize content and structure in this site collection.">
    <UrlAction Url="~site/_layouts/sitemanager.aspx"/>
    </CustomAction>
    </Elements>

  8. Build the Project. Open the feature.xml file and verify that if contains the reference to the element.xml file.
  9. Now Deploy the wsp and activate the feature in your site.

Read It

When you create a CustomAction element, you must add an inner UrlAction element that contains a Url attribute. When you redirect the user to an application page, such as SiteManager.aspx, you must consider whether you want the application page to run inside the context of the current site or the current site collection. In the following example, the dynamic token ~site is added to the beginning of the URL. When Windows SharePoint Services parses this CustomAction element and creates the menu item, it replaces ~site with the actual URL of the current site.

"~site/_layouts/sitemanager.aspx"

The key to security trimming your custom action is the Rights attribute. This attribute allows you to specify SharePoint permissions that the user must have for the action to be visible. This can be a comma delimited list. For example:

Rights="ViewListItems,ManageAlerts"

When more than one value is specified, the set of rights are treated with an AND. This means the user must have all of the specified rights for it to be visible. Here is a list of the valid Microsoft.SharePoint.SPBasePermissions you could use:

http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions

Also, When you create the element for a custom menu item in the Site Actions menu, you have the option to configure it so that it is shown only to users who have administrative permissions. Note in the following example the addition of a new attribute named RequireSiteAdministrator.

RequireSiteAdministrator="TRUE"

When you add the RequireSiteAdministrator attribute, Windows SharePoint Services does not show the menu item to users who do not have administrative permissions. For a CustomAction element in a Feature that is scoped at the site-collection level, the menu item appears only for the site collection owner or administrator. For a CustomAction element in a Feature that is scoped at the site level, the menu item appears only to those who have administrative permissions within the current site.

Finally

siteaction

Related Link: http://blogs.msdn.com/b/edhild/archive/2008/01/16/how-to-add-security-trimming-info-to-custom-actions-in-sharepoint.aspx