Edit properties – Access denied error in document libraries

May 25th, 2009 | Categories: SharePoint, SharePoint administration

A very interesting symptom occurred to me the past time. In a document library I was trying to edit document properties but I received an error that I don’t have rights. Strange. Even if I tried to edit with a site collection administrator account, I got the same error.

After searching for a while, I’ve found the solution. Looks like a bug that is fixed with February update, but you have to fix the existing bugs manually.

You can find the solution on Social TechNet. Using Visual Studio create a console application and copy-paste the code published there. I’ve made slight modification to the code, because I needed to have this fix in a subsite:

Old code:

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using System.Xml;

namespace CA_TestingHotfix
{
    class Program
    {
        static void Main(string[] args)
        {
            FixField(args);
        }

        static void FixField(string[] args)
        {
            string RenderXMLPattenAttribute = "RenderXMLUsingPattern";

            //Console.WriteLine("Please enter the URL of the site: (Press enter after typing):");
            string weburl = args[0];

            //Console.WriteLine("Please enter the Document Library Name: (Press enter after typing):");
            string listName = args[1];
            SPSite site = new SPSite(weburl);
            SPWeb web = site.OpenWeb();
            SPList list = web.Lists[listName];

New code (changes marked with bold)

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using System.Xml;

namespace CA_TestingHotfix
{
    class Program
    {
        static void Main(string[] args)
        {
            FixField(args);
        }

        static void FixField(string[] args)
        {
            string RenderXMLPattenAttribute = "RenderXMLUsingPattern";

            //Console.WriteLine("Please enter the URL of the site: (Press enter after typing):");
            string weburl = args[0];
            string subwebUrl = args[1];

            //Console.WriteLine("Please enter the Document Library Name: (Press enter after typing):");
            string listName = args[2];
            SPSite site = new SPSite(weburl);
            SPWeb web = site.OpenWeb(subwebUrl);
            SPList list = web.Lists[listName];

 

After you have the code ready, compile the program, put it on the server and run the command

[programName].exe [http://site_coll_url] [subweburl] [document_library_name]

If you need to run it for example on the top level web see the example below

fixDocLib.exe –url http://testSite:8080 / “Shared Documents”