SharePoint Review Center

Everything about SharePoint – Architecture, Design, Development, Configuration, Administration, Issues, and Fixes

Posts Tagged ‘permmask’

Access Denied Error Message While Editing Properties of any Document in a MOSS Document Library

Posted by Anthony Odole on January 30, 2009

 

When we go to properties of any document in document library even with full permission, we get access denied message if we try to edit the document properties. However we can open and edit the document successfully.

 

This is one of those errors that you spend a lot of time troubleshooting without a clue of why this is happening. As an experienced MOSS developer, you probably assume this is a permission issue; With this assumption, you use farm administrator account to log into the site, still you get access denied error page. You tried so many other steps, all to no avail. There is a good news and a bad news. Which one will you like me to talk about first? Just kidding!

 

Ok. The Good news is that you did not create or cause this issue. The bad news is that it is a bug. I’ve called and discussed this with the folks at Microsoft. There are two ways to fix this. Use step 1 to fix this issue in existing document libraries. Use step 2 to fix it in existing list templates

 

 

Step 1. For existing lists, you can run the following code to fix it. This here is a sample peace of code that should add the appropriate attribute to the list having the issue:

 

void FixField()

{

string RenderXMLPattenAttribute = “RenderXMLUsingPattern”

string weburl = “<http://localhost>”

string listName = “test2”

SPSite site = new SPSite(weburl);

SPWeb web = site.OpenWeb();

SPList list = web.Lists[listName];

SPField f = list.Fields.GetFieldByInternalName(“PermMask”);

string s = f.SchemaXml;

Console.WriteLine(“schemaXml before: ” + s);

XmlDocument xd = new XmlDocument();

xd.LoadXml(s);

XmlElement xe = xd.DocumentElement;

if (xe.Attributes[RenderXMLPattenAttribute] == null)

{

XmlAttribute attr = xd.CreateAttribute(RenderXMLPattenAttribute);

attr.Value = “TRUE”

xe.Attributes.Append(attr);

}

string strXml = xe.OuterXml;

Console.WriteLine(“schemaXml after: ” + strXml);

f.SchemaXml = strXml;

}

 

Step 2: For existing stp (list templates) that are having this problem, you should be able to modify the manifest.xml to add the attribute, and repackage the stp. You simply would rename the .stp file to a .cab file, open the manifest.xml file packaged in the cab, make this change that is highlighted:

 

<Field ID=”{BA3C27EE-4791-4867-8821-FF99000BAC98}”

Name=”PermMask”

SourceID=”http://schemas.microsoft.com/sharepoint/v3

StaticName=”PermMask”

RenderXMLUsingPattern=”TRUE”

Group=”_Hidden”

ReadOnly=”TRUE”

Hidden=”TRUE”

ShowInFileDlg=”FALSE”

Type=”Computed”

DisplayName=”$Resources:core,Effective_Perm_Mask;”>

<FieldRefs>

<FieldRef ID=”{1d22ea11-1e32-424e-89ab-9fedbadb6ce1}” Name=”ID”/>

</FieldRefs>

<DisplayPattern>

<CurrentRights/>

</DisplayPattern>

</Field>

 

Then repackage the manifest.xml file to a .cab file and rename it back to .stp. Upload the list template to the template gallery. Any subsequent lists created with this template should work as expected.

Microsoft promised to fix this in the next hotfix. Please note that to prevent new list templates from having this problem, you will need to update the fieldswss.xml via the next Hotfix. Please do not update fieldswss.xml manually.

 

 

** About the Author: Anthony Odole is a Senior Solution Architect with IBM Global Services. He is a SharePoint Subject Matter Expert. You can reach him at Odolea@gmail.com

Advertisements

Posted in Uncategorized | Tagged: , , , , , | 24 Comments »