Wednesday, July 1, 2015

Sharepoint 2007 - Access Denied when you try to edit

Recently I received an “Access Denied” error when I try to edit the list item in SP 2007.

I found the following solution from here (I coped same text below), which resolved the issue.

 

Here is the situation:

  • In a site collection, you make a new list/document library in any sub-site or the main website.
  • You then add a new item/document to the folder, and then attempt to edit the item
  • You then see something along the lines of "Access Denied" , even if you are on the system account.
  • This happens with every new list you create on any site or subsite.
Your problem is a corrupted field definition at the site collection level.

Specifically the "Effective Permissions Mask" is missing an attribute in it's xml scheme -

RenderXMLUsingPattern="TRUE"

The fix comes in 3 steps:

1. Update your server to the most recent cumulative update package (Service pack 2 or greater). You can get more information about this from the Sharepoint team blog post on SP2. Included in SP2 is a hotfix that prevents this from occurring ever again on any other site collections, but it does not fix sites already effected by it.


2. To fix sites that are already having this problem, first we need to fix the field definition. Thanks to Vicki Dillon who pointed me in the right direction (but the wrong field =) )

The easiest way to accomplish this is to use: sharepoint manager 2007


  1. Run sharepoint manager 2007 and navigate to the site collection you are having problems with.
  2. Expand the site collection until you see "Fields"
  3. Scroll down this long list until you come to "Effective Permissions Mask" (also goes by the static name of PermMask )
  4. Go to the SchemaXML, copy it out into notepad to wordpad, and add the following value:
  5. RenderXMLUsingPattern="TRUE"
    (I just tacked that onto the end, right before version="1")

This will prevent new lists from being created with out the RenderXMLUSingPatter=True value.

3. Now to fix the lists you already have made that need fixing.. You can either do this using SPmanger or you can do my favored option and fire up visual studio and compile the following 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];
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;
}
}
}

Since this touches the Sharepoint Model directly, remember to add the assembly reference to your local copy of Microsoft.sharepoint.dll to avoid compiling errors. Thanks to Jeff1024 for posting this code he got from the microsoft support team.

Run the program on the local server from the command line with two variables, the first one is the site that the list you are fixing is located in, the second is the name of the list to fix.

Tuesday, May 19, 2015

SharePoint 2013 Manage Services link missing

I noticed “Manage Services on Server” link is missing from Central Administration, I know it should be there under System Settings.

 

After google, I found its a common issue most users have and solution is “Try running IE with elevated privileges, (run as administrator)”