2

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.

1 Answer 1

0

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

1
  • Ouch.. sorry to hear that. How were you updating the web.config? Manually?
    – Kit Menke
    Jan 24, 2012 at 22:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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