Edit properties – Access denied error in document libraries

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

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”

  1. Bart
    February 11th, 2010 at 14:09
    Reply | Quote | #1

    Hi, I’m just a newbie in Sharepoint.

    Could you, at least, provide a step by step instruction as to how I can run the code. It will be a big help. Thank you.

  2. Michael Caldecott
    March 9th, 2010 at 19:50
    Reply | Quote | #2

    We have came across your Wordpress bog regarding WSS 3.0 and errors when editing properties. Over night this happened to us, and I am in the deep end with so many new sub sites with this issue. However I do not know how to use VB, do you have this script as an exe application? Any help would be appreciate, I’m sure it shall only take you a few moments to help out a strange on the over side of the world….

    • Boris Gomiunik
      March 10th, 2010 at 00:00
      Reply | Quote | #3

      @Michael Caldecott: Hi. Yes, the exe application is available. Direct link is http://gomiunik.codeplex.com/releases/view/27906. You will need access to backend server. If you wish I can prepare this as a SharePoint feature so you’d be able to make the fix directly in SharePoint site.