Showing posts with label Moss 2007. Show all posts
Showing posts with label Moss 2007. Show all posts
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.

Friday, August 30, 2013

SharePoint 2007 – Custom Alert Template Issue

Recently one of our Business user requested to use “Custom Alerts on old SharePoint” even though we are in the process of upgrading to SharePoint 2013.

 

Anyway I found a nice article to implement “Custom Alert Templates” here. This is what I did, in simple steps.

  • Created a copy of “AlertTemplates.xml” found in 12 hive\Templates\XML
  • Created a new “AlertTemplate” section with in the XML and gave the unique name (simply copy the GeneraicList and renamed the Name)
  • Made couple of changes to Styles and layout (adding new tables to show Company logo)
  • Ran the STSADM command to update the template
  • Create a  small tool in VS to update the template name to specific list
  • Reset the IIS
  • Reset the SharePoint Timer Service

 

Even though I followed same as mentioned in the article, still alert emails are defaulting to the old template no matter what i did (Even I made exact changes to generic list section to see at least its falling into that)

 

After spending couple of days, I removed existing alerts on the list and created new one. Now i see the emails with update template.

I found out that, if we already have alerts setup on the list before updates, even you change the list to use different template (through code), SharePoint still sends alert emails using the template that was assigned to the list at the time of Alert setup.

 

Lesson learned !!!

Tuesday, September 6, 2011

SharePoint DateTime Control Date Format

If you are working with DateTime Control in SharePoint, you might have a requirement to show date format (For example DD/MM/YYYY) based on the user regional setting instead of US date format (MM/DD/YYYY)

 

You can specify the regional settings locale id to DateTime local id on Page Load

 

int localId = Convert.ToInt32(SPContext.Current.RegionalSettings.LocaleId); 
dtpcStartDate.LocaleId = localId;


If you want to change the default date format, no matter what the user regional setting is, you can do it my writing the custom control by deriving from the Microsoft.SharePoint.WebControls.DateTimeControl.



 

public class CustomDatePicker : Microsoft.SharePoint.WebControls.DateTimeControl
{
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
TextBox tb= (TextBox)this.Controls[0];
DateTime dt = DateTime.Parse(tb.Text);
tb.Text = dt.ToString("dd/MM/yyyy");

}

}
}


Note: For above code, I used the Autopostback = true to trigger OnPreRender event until i figure it out how to trigger onDateChangeed event client side.

Thursday, August 25, 2011

How to show dates which has TBD at the end of the SharePoint List?

I am working on the two custom web parts, one of them is filter web part and another one is a results web part which shows data filtered from the SharePoint list based on the user selection. In the filter web part, we have a date range where they can specify certain range or just leave it empty so that we just return records which are greater than or equal to current date. Since dates are not mandatory in my SharePoint list (user don’t have a date and it is TBD – to be decided), it either shows empty dates at the top if i order by dates in ascending order without any filter criteria or it won’t show empty dates if i apply filter criteria.

 

But my requirement is,

  • we should show empty dates (TBD)
  • TBD should be at the end of the result set and not in the beginning of the result set.

To implement this, we created a calculated field and use the following formula

=IF(ISBLANK(DateColumn),DATE(2099,1,1),DateColumn)

 

Where

DateColumn – is a column we used to store the user selected date in the List.

 

Above formula we used max date (01/01/2099), so that we can easily use “Greater than or equal to” to compare with other dates and also sort dates in ascending order so that max dates will so at the end.

 

In the results web part, we are using XSLT to show the data and in that we are checking dateColumn empty or not, if empty show TBD or else show actual date.

 

Hope this helps some one and have a happy programming.

Thursday, August 11, 2011

Connected Web Part Approaches

I found a very nice article about Connected web parts.

Thursday, February 24, 2011

No Edit Page Option in Site Actions in MOSS 2007

Today I tried to Edit the Form pages to add Web Parts, for somehow, i Couldn’t see the option under Site Actions. I found a short cut to edit the page using ?ToolPaneView=2.

For Eg: http://SHAREPOINTSITE/Lists/Test List/NewForm.aspx?ToolPaneView=2

Tuesday, February 22, 2011

Navigate to Web Part Maintenance Page in SharePoint

As most of you know that there are two options to remove web parts from a SharePoint  page.

  • Close – preserves the web part’s configurations and customizations in Closed Web Parts gallery.
  • Delete – deletes permanently.

If you want to see list of all closed web parts on the page, you have to go to Web part maintenance page. However, there is no easy way to get to this page.

 

A quick way to navigate to Web Part maintenance page in both SharePoint 2007 and SharePoint 2010

 

Option 1:

Copy the following code in browser and make changes accordingly,

http://[SERVERNAME]/_layouts/spcontnt.aspx?pageview=shared&url=[Your Web Part Page URL] (For Example: /FirmCalendar/pages/default.aspx)

 

Option 2: (Much easier)

Just append the querystring “?Contents=1” to any page that contains Web parts as shown below,

http://[SERVERNAME]/default.aspx?contents=1

 

Note: In SharePoint Server 2010, a closed Web part no longer consumes the system resources as open Web parts do.

Tuesday, November 30, 2010

How to change Page Layout of existing page in SharePoint?

Recently a task was assigned to me to make sure that dev site should look like production one. First thing i noticed when i comparing two sites is both pages using different page layouts. so the question is how do you change the page layout which associated with your current page?

It is really simple once you know where to look.

  1. Go to the Page which you want to change. In my case i need to change my home page. so i browse http://mysite/home.aspx
  2. Click Site Actions and then select Edit Page option.
  3. On the toolbar, Click on Page and then select Page Settings
    image
  4. Now you can pick your page layout
  5. Click OK once you done with your changes

 

Thursday, August 19, 2010

SharePoint List Template Id’s

Following table shows the default list template and its Id’s.

 

100    Generic list
101    Document library
102    Survey
103    Links list
104    Announcements list
105    Contacts list
106    Events list
107    Tasks list
108    Discussion board
109    Picture library
110    Data sources
111    Site template gallery
112    User Information list
113    Web Part gallery
114    List template gallery
115    XML Form library
116    Master pages gallery
117    No-Code Workflows
118    Custom Workflow Process
119    Wiki Page library
120    Custom grid for a list
130    Data Connection library
140    Workflow History
150    Gantt Tasks list
200    Meeting Series list
201    Meeting Agenda list
202    Meeting Attendees list
204    Meeting Decisions list
207    Meeting Objectives list
210    Meeting text box
211    Meeting Things To Bring list
212    Meeting Workspace Pages list
300    Portal Sites list
301    Blog Posts list
302    Blog Comments list
303    Blog Categories list
1100   Issue tracking
1200   Administrator tasks list
2002   Personal document library
2003   Private document library

How to find the template name of SharePoint site?

When you look into any SharePoint site which was created by someone, first question you get is, Which template they used to create the site? It is very difficult to tell by looking at the site.

I used following approaches to find template names/ids

Approach 1: Save the site as a template

  1. Go to Site template Gallery and download the save the template to your desktop
  2. Rename the template extension from .stp to .cab.
  3. Extract .cab file contents. (I normally use WINRAR)
  4. open the manifest.xml file.
  5. Search for TemplateID and Configuration.

 

ID 0 = Global, Configuration 0 = Global Template
ID 1 = STS or SharePoint Team Site, Config  0 = Team Site
ID 1, Config 1 = Blank Site
ID 1, Config 2 = Document Workspace
ID 2 = MPS, or Meeting Place Sites, Config 0 = Basic Meeting Workspace
ID 2, Config 1 = Blank Meeting Workspace
ID 2, Config 2 = Decision Meeting Workspace
ID 2, Config 3 = Social Meeting Workspace
ID 2, Config 4 = Multipage Meeting Workspace
ID 3 = Centraladmin, config 0 - Central Admin Site
ID 4 = WIKI, Config 0 = Wiki site
ID 5, Config 0 = Blog

Any ID over 10000 is custom.

If ID is 75800 range, it might be additional Microsoft applications and templates. You can Check here.

Approach 2: Using custom ASPX page

http://blog.rafelo.com/2008/05/determining-site-template-used-on.html

Thursday, August 12, 2010

Redirect a SharePoint Site/Page to another Site/Page using Content Editor Web Part

Redirecting the user from one site/page to another site/page is most common scenario.

You might have several reasons for this like Site Move from one location to another or Point Staging to Production etc..,

 

For whatever reason, you can achieve this functionality easily using Content Editor WebPart.

 

Copy and paste the following code into your Custom Editor WebPart

 

<script language=”JavaScript”>

alert(“The site has been moved to a new location and will automatically redirect to the location.  Please update your bookmarks accordingly."”);

</script>

<meta http-equiv=”refresh” content=”0;url=http://[YOUR NEW LOCATION]”>

 

Once you save these changes, you are not able to modify any thing on this page since it is redirect to new location.

If in case you want to remove this webpart, the workaround is, you have to go through webpart maintenance page.

 

Copy the following code in Browser Address and make changes accordingly

http://[SERVERNAME]/_layouts/spcontnt.aspx?pageview=shared&url=[Your WebPart Page URL] (For Example: /FirmCalendar/pages/default.aspx)

image

Select the checkbox which you want to close, and click close button

image

 

 

To enable the closed WebParts follow these steps

1. Go To Site Actions –> Edit Page

2. Click on any Add WebParts

image

3. Click on “Advanced WebPart Gallery and Options

image

4. Click on Closed Web Parts link

image

5. Drag and drop the Content Editor WebPart Where ever you want.

 

Hope this helps some one.

Thursday, June 17, 2010

Enable AJAX Support in SharePoint,WSS, MOSS 2007

Microsoft suggests the following changes to web.config for your SharePoint installation if you want to enable AJAX functionality. http://msdn.microsoft.com/en-us/library/bb861898.aspx

 

I found the this file ( http://www.hansrasmussen.com/2010/02/enable-ajax-support-in-sharepointwss-moss-2007/ ) which enable AJAX support in MOSS 2007 using Feature.

Wednesday, June 16, 2010

SharePoint DateTimeControl returns today's date if there is no selected date

By Default SharePoint DateTimeControl returns today's date if there is no selected date. Use IsDateEmpty to check whether user selected any date or not. If IsDateEmpty returns true, means no date selected by the user otherwise user selected the date and use that date.

 

 

if (!((DateTimeControl)c).IsDateEmpty)
{
    columnValue = ((DateTimeControl)c).SelectedDate.ToString();
}
else
{
    columnValue = "";
}

Thursday, March 11, 2010

Event manager error: Could not load file or assembly

We have created a Custom SharePoint List Event handler to call our custom application (Web Services) when new item is added to the SharePoint List. Everything was worked in production server for first time (Register Event Handler). As soon as a new item was created, event handler was triggered and its called our web services. After we made some changes and reregister the event handler, this time event handler was not triggered somehow. We checked the register process and it same we followed first time, no difference, but still didn’t work.
Wednesday, February 10, 2010

How to Delete SharedServices?

What ever reason you want to delete the shared services, because of wrong name or wrong site, you can do it either using UI or STSADM tool. Some times UI delete option is disabled, so you dont have any choice other than using STSADM tool.

Thursday, January 21, 2010

How to Increase the maximum size of list templates?

Problem / Issue:
Saving a list as template is an easy way of transferring data from one place to another in SharePoint. By default, however the maximum size of list templates in  WSS3.0 and MOSS 2007 is 10 MB.

If you try to save the list as template that is larger than this you will get the follwoing error.
The list is too large to save as a template. The size of a template cannot exceed 10485760 bytes.
Tuesday, November 10, 2009

How to uncheck the send welcome email checkbox option globally?

In SharePoint, we have an option (checkbox) to send a welcome email to newly added users and this checkbox is checked by default. In my case this option is vary annoying since in most cases we don’t send an email to newly added users but sometimes i forgot to uncheck the checkbox. So i started looking into ways to ease my life.

First thing i want to find is,  was there any global setting to flip the checkbox? but there is none. So my next option is modify/edit the aclInv.aspx page which is in Layouts folder in SharePoint hive.

  1. Navigate to SharePoint Hive\TEMPLATE\LAYUTS folder.
  2. Find the aclInv.aspx file.
  3. This step is optional but I recommend to backup this file before making any changes.
  4. open the aclInv.aspx in editor.
  5. Search for “chkSendEmail”.
  6. Change Checked property from True to False.
  7. Save the page.

Repeat the same steps in all web front end servers.

Friday, February 20, 2009

What’s the Purpose of Shared Service Provider (SSP) in SharePoint (MOSS) 2007?

Most of you already know that SharePoint gives you the ability to crate and host multiple separate web applications,for example, intranet site, internet/Extranet, Team site, etc. In MOSS 2007, Microsoft comes with a new concept of Shared Services Providers(SSP). The idea behind this concept is to manage and share certain services centrally instead of each web application level. The best examples are Profiles and Search service. Using Profile service, you can import all of the user information from Active Directory once and then use  that data within different web applications. In the same way you can also setup the search service one time and then share it across multiple web applications. It make prefect sense, right?

 

The major services that are handled by SSP are,

  • Profiles
  • Search
  • Indexing
  • My Sites
  • Audiences
  • Excel Services
  • Business Data Catalog (BDC)

Another major advantage of SSPs is separation of roles. It is most common in medium to large server farms to have one group administrating the physical servers and another group maintain search/profiles. Since SSP is its own site collection, you can define a user access so that they can not access Central Administration site but they can access the SSP. Even in SSP you can limit then what they can access.

 

As a general rule, you use single SSP. But there are some scenarios you may want to create multiple SSPs. For example, you may need separate set of permissions and services for intranet site and extra net site. You have to be vary cautious about creating multiple SSPs.

 

Final Thoughts

Shared Service Providers (SSPs) are one of the great feature in MOSS 2007. Creations of SSPs should be part of your initial planning. In SSPs, You can grant permissions at a granular level or broad access.

 

I hope this was useful and you understand clearly what’s the purpose of SSPs?

Saturday, November 22, 2008

Custom Actions in SharePoint 2007

WSS 3.0 and MOSS 2007 now have a supported extensibility mechanism allowing developers to easily add links to existing menus or Site Settings.

 

Custom Actions can be used to add new custom functionality to many places in WSS and MOSS. Depending on where the custom action is located determines the user interface of the custom action. For example if you create a custom action for the Site Actions menu the result is a menu item anchored in the control. If you create a Custom Action for the Site Settings page you will see a link.  Creating a custom action for a list's display form toolbar results in a toolbar button. As you can see just from this small list a Custom Action provides a lot of extensibility in WSS and MOSS.

Each custom action exists in a specific location, and depending on that location, can be a part of a group of actions. You can find the Default Custom Action Locations and IDs in Microsoft site.

With a custom action feature, you can:

  • Add a new Custom Action Group which can be used to group custom actions in a specific options screen;
  • Add a new Custom Action which can be a new option in a settings screen, a new menu item, or a new toolbar button;
  • Hide an existing Custom Action whether that action is the result of custom action feature or it belongs to SharePoint's out-of-the-box features.

 

How to Create a Custom Action Feature

  1. Create a new Project in VS 2008.
  2. Within the project create the following folder structure image
  3. Within the MyCustomActions folder, Add a new item and select XML file. Name it as CustomActions.xml
  4. Add the following text and make the changes accordingly.

    <?xml version="1.0" encoding="utf-8" ?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <!-- Custom Action Group -->
    <CustomActionGroup
    Id="MyActionGroup"
    Description="This group contains all my custom actions."
    Title="My Action Group"
    Location="Microsoft.SharePoint.SiteSettings"
    Sequence="30" />

    <!-- Custom Action in Custom Action Group -->
    <CustomAction
    Id="MyCustomAction"
    Description="This link is a custom action."
    Title="My Custom Action"
    GroupId="MyActionGroup"
    Location="Microsoft.SharePoint.SiteSettings"
    Rights="ManageWeb"
    RequireSiteAdministrator="FALSE"
    Sequence="20">
    <UrlAction Url="~sitecollection/_layouts/MyCustomPage1.aspx" />
    </CustomAction>

    <!-- Custom Action in Site Actions Menu -->
    <CustomAction
    Id="MyNewCustomAction"
    Description="This menu item is a new custom action."
    Title="My New Custom Action"
    GroupId="SiteActions"
    Location="Microsoft.SharePoint.StandardMenu"
    ImageUrl="/_layouts/MyActionIcon.jpg"
    Sequence="10">
    <UrlAction Url="~sitecollection/_layouts/MyCustomPage2.aspx" />
    </CustomAction>

    <!-- Hide Custom Action -->
    <HideCustomAction
    Id="HideDeleteWeb"
    GroupId="SiteAdministration"
    Location="Microsoft.SharePoint.SiteSettings"
    HideActionId="DeleteWeb" />
    </Elements>

     




  5. Within the MyCustomActions folder, Add a new item and select XML file. Name it as feature.xml


  6. Add the following text and make the changes accordingly.

    <?xml version="1.0" encoding="utf-8"?>

    <Feature  Id="Paste your NEW GUID Here"


              Title="My Custom Actions"


              Description="My Custom Actions"


              Version="12.0.0.0"


              Scope="Site"


              xmlns="http://schemas.microsoft.com/sharepoint/">


      <ElementManifests>


        <ElementManifest Location="CustomActions.xml" /> 
      </ElementManifests>


    </Feature>




  7. Build the project using WSPBuilder and deploy the WSP.



Custom Actions really provide us with a great mechanism to place our needed extensions into the menus of WSS and SPS. This post about Custom Actions is a very simple start to what you can do. If you want to know more about Features, check this nice article SharePoint 2007 Deployment: Overview.

Monday, November 10, 2008

Error - You need to be a site collection administrator to set this property

Today I restore a site collection from different server to my VM and when I try to update the site Collection Administrators info on the site I received “you need to be a site collection administrator to set this property”. And also I don’t see the Site Settings and others which you normally see under site Action menu.

 

After a quick google, I found that Site Collection was locked and I need to unlock it. To unlock site collection, Go to central Admin –> Application Management. Click on “Site collection quotas and locks” under “SharePoint site Management”, then select “Not Locked” option.

 

Hope this post helped someone.