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 have a relatively simple workflow activity that just removes all permissions on a list item.

This activity runs great in our test environments which is 2k8 r2 64bit. However, when we GAC the assembly and do all the necessary configuration on the production server (2k3 32 bit), the workflow activity is selectable in SharePoint Designer but nothing happens when it is clicked.

I have gone through several articles and even have a case open with MS but thought I would stop by here to see what you all might suggest.

Here is the web.config entry

<authorizedType Assembly="Sharepoint.DeletePermissionsAct, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3f4de48b427cc4f8" Namespace="Sharepoint.DeletePermissionsAct" TypeName="*" Authorized="True" />

and the entry in the WSS.ACTIONS file:

<Action Name="Delete existing permissions" ClassName="Sharepoint.DeletePermissionsAct" Assembly="Sharepoint.DeletePermissionsAct, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3f4de48b427cc4f8" AppliesTo="all" Category="Custom Actions"> <RuleDesigner Sentence="Delete existing permssions in %1"> <FieldBind Field="ListId,ListItem" Text="this list" Id="1" DesignerType="ChooseDoclibItem" /> </RuleDesigner> <Parameters> <Parameter Name="__Context" Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions" Direction="In"/> <Parameter Name="ListId" Type="System.String, mscorlib" Direction="In" /> <Parameter Name="ListItem" Type="System.Int32, mscorlib" Direction="In" /> </Parameters> </Action>

And finally the source code:

namespace Sharepoint.DeletePermissionsAct
{
    public partial class DeletePermissions : Activity
    {
        public static DependencyProperty __ContextProperty = System.Workflow.ComponentModel.
           DependencyProperty.Register("__Context", typeof(WorkflowContext), typeof(DeletePermissions));

        [Description("Context")]
        [ValidationOption(ValidationOption.Required)]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public WorkflowContext __Context
        {
            get { return ((WorkflowContext)(base.GetValue(DeletePermissions.__ContextProperty))); }
            set { base.SetValue(DeletePermissions.__ContextProperty, value); }
        }

        public static DependencyProperty ListIdProperty = System.Workflow.ComponentModel.
            DependencyProperty.Register("ListId", typeof(string), typeof(DeletePermissions));
        [Description("ListId")]
        [ValidationOption(ValidationOption.Required)]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public string ListId
        {
            get { return ((string)(base.GetValue(DeletePermissions.ListIdProperty))); }
            set { base.SetValue(DeletePermissions.ListIdProperty, value); }
        }

        public static DependencyProperty ListItemProperty = System.Workflow.ComponentModel.
            DependencyProperty.Register("ListItem", typeof(int), typeof(DeletePermissions));
        [Description("ListItem")]
        [ValidationOption(ValidationOption.Required)]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public int ListItem
        {
            get { return ((int)(base.GetValue(DeletePermissions.ListItemProperty))); }
            set { base.SetValue(DeletePermissions.ListItemProperty, value); }
        }



        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            SPWeb tempWeb = (SPWeb)__Context.Web;
            SPUserToken systemToken = GetSystemToken((SPSite)__Context.Site);

            using (SPSite site = new SPSite(((SPSite)__Context.Site).ID, systemToken))
            using (SPWeb spWeb = site.OpenWeb(tempWeb.ID))
            {
                SPList list = spWeb.Lists[new Guid(this.ListId)];
                SPListItem listItem = list.GetItemById(this.ListItem);
                listItem.ResetRoleInheritance();
                listItem.BreakRoleInheritance(false);
                listItem.Update();
            }



            return ActivityExecutionStatus.Closed; 

        }

        private SPUserToken GetSystemToken(SPSite site)
        {
            site.CatchAccessDeniedException = false;
            try
            {
                return site.SystemAccount.UserToken;
            }
            catch (UnauthorizedAccessException)
            {
                SPUserToken systemToken = null;
                SPSecurity.RunWithElevatedPrivileges(
                    delegate()
                    {
                        using (SPSite elevatedSite = new SPSite(site.ID))
                        {
                            systemToken = elevatedSite.SystemAccount.UserToken;
                        }
                    });
                return systemToken;
            }
        }
    }
}

Again, this does work in a test environment with a different OS. Note that the custom workflow activities available via codeplex do work in our production environment so its apparent that custom workflow capabilities are available but not for our solution.

Also, we have done several IIS resets, confirmed the assembly is GAC'd and cleared the local SharePoint designer cache.

share|improve this question
add comment

1 Answer

Well looks like I was looking at/updating the wrong web.config, it was installed on a entirely seperate drive.

share|improve this answer
    
Ouch.. sorry to hear that. How were you updating the web.config? Manually? –  Kit Menke Jan 24 '12 at 22:27
add comment

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.