Saturday, July 18, 2009

Enumerate SharePoint Features

. Saturday, July 18, 2009
0 comments

Enumerate Installed Features in the Farm

TreeView TreeView1 = new TreeView();

TreeView1.Nodes.Add(new TreeNode("Features"));
TreeNode oFSiteNode = null;
TreeNode oFNode = null;

SPSecurity.RunWithElevatedPrivileges(delegate()
{

//get the name of the current web in current user's context

                string spSiteURL = SPControl.GetContextSite(Context).Url.ToString();

                //Initialize the spweb object using the elevated privileges
                using (SPSite oSite = new SPSite(spSiteURL))
                {


TreeView1.Nodes.Clear();

#region Return Installed Features.

                    oFSiteNode = new TreeNode("All Farm Installed Features");

                    SPFarm oFarm = oSite.WebApplication.Farm;

                    SPFeatureDefinitionCollection oFeatDefColl = oFarm.FeatureDefinitions;
                    foreach (SPFeatureDefinition oFeatDef in oFeatDefColl)
                    {
                        if (oFeatDef != null)
                        {
                            oFNode = new TreeNode(oFeatDef.GetTitle(new System.Globalization.CultureInfo(1033)));
                            oFSiteNode.ChildNodes.Add(oFNode);
                        }
                    }

                    TreeView1.Nodes[1].ChildNodes.Add(oFSiteNode);

#endregion

TreeView1.CollapseAll();
oSite.Dispose();

}

}

Enumerate Site collection and Site Content Types

.
0 comments

I will be creating a web part that enumerates root site and all it's subsites content types along with their columns.

We will be using a Tree View control for this.

using System;
using System.Collections.Generic;
using System.Text;

using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Microsoft.SharePoint.WebControls;

/// <summary>
        /// Shows content types recursively
        /// </summary>
        /// <param name="oWeb">The parent node</param>
        /// <param name="oNode">The content Type node</param>
        protected void ShowCTypes(SPWeb oWeb, TreeNode oNode, SPContentTypeId contTypeID)
        {
            TreeNode oSubNode = null;
            SPContentTypeCollection oCTypeColl = oWeb.ContentTypes;

            foreach (SPContentType conttype in oCTypeColl)
            {
                //if current type is child of parameter oNode and is not the root ctype
                if (conttype.Parent.Id == contTypeID && conttype.Parent.Id != conttype.Id)
                {
                    oSubNode = new TreeNode(conttype.Name);
                    oSubNode.NavigateUrl = oWeb.ServerRelativeUrl + "/_layouts/ManageContentType.aspx?cType=" + conttype.Id;
                    oSubNode.Target = "_blank";

                    //add columns
                    ShowCtypeColumns(oSubNode, conttype);
                    //add subnodes
                    oNode.ChildNodes.Add(oSubNode);

                    //now oSubNode is the parent node
                    ShowCTypes(oWeb, oSubNode, conttype.Id);
                }
            }

        }

        /// <summary>
        /// Shows columns for a content type
        /// </summary>
        /// <param name="oNode">Current content type Treenode</param>
        /// <param name="contType">Content type whose columns are to be added</param>
        protected void ShowCtypeColumns(TreeNode oNode, SPContentType contType)
        {
            TreeNode oSubNode = null;

            //fetch fields of content type
            SPFieldCollection oFldColl = contType.Fields;

            if (oFldColl.Count != 0)
                oNode.ChildNodes.Add(new TreeNode("Columns"));

            foreach (SPField oField in oFldColl)
            {
                if (!oField.Title.Equals("ContentType") && !oField.Hidden)
                {
                    oSubNode = new TreeNode(oField.Title);
                    oSubNode.NavigateUrl = contType.ParentWeb.ServerRelativeUrl + "/_layouts/ManageContentTypeField.aspx?cType=" + contType.Id + "&Field=" + oField.InternalName + "&Fid=" + oField.Id;
                    oSubNode.Target = "_blank";
                    oNode.ChildNodes[0].ChildNodes.Add(oSubNode);
                }
            }

        }

/// <summary>
        /// Creates Treeview nodes for content types and features.
        /// </summary>
        protected void CreateControls()
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                TreeView1.Nodes.Clear();
                TreeView1.Nodes.Add(new TreeNode("Content Types"));

                //get the name of the current web in current user's context

                string spSiteURL = SPControl.GetContextSite(Context).Url.ToString();

                //Initialize the spweb object using the elevated privileges
                using (SPSite oSite = new SPSite(spSiteURL))
                {
                    SPWebCollection oWebColl = oSite.AllWebs;

                    #region Add content types

                    TreeNode oSiteNode = null;
                    foreach (SPWeb oWeb in oWebColl)
                    {
                        //create website nodes
                        oSiteNode = new TreeNode(oWeb.Title);
                        oSiteNode.NavigateUrl = oWeb.Url;

                        //get contenttypes collection for each subsite including root site
                        SPContentTypeCollection oCTypeColl = oWeb.ContentTypes;
                        TreeNode oNode = new TreeNode();

                        //if site doesn't have any Ctypes (only content types defined for that particular site are displayed)
                        if (oCTypeColl.Count != 0)
                        {
                            oNode.Text = oCTypeColl[0].Name;
                            oNode.NavigateUrl = oWeb.ServerRelativeUrl + "/_layouts/ManageContentType.aspx?cType=" + oCTypeColl[0].Id.ToString();
                            oNode.Target = "_blank"; //opens link in new window

                            //send current site and root contenttype node (not the actual content type)
                            ShowCTypes(oWeb, oNode, oCTypeColl[0].Id);

                            //add root contenttype node to website node
                            oSiteNode.ChildNodes.Add(oNode);

                        }
                        //add website node to root node of treeview.
                        TreeView1.Nodes[0].ChildNodes.Add(oSiteNode);
                        oWeb.Dispose();
                    }
                    #endregion

 

TreeView1.CollapseAll();
                    oSite.Dispose();
                }
            } //end of delegate
            ); //end of RunWithElevatedPrivileges

        }

        protected override void OnPreRender(EventArgs e)
        {
            CreateControls();
        }

        protected override void CreateChildControls()        {
            //add control to treeview
            this.Controls.Add(TreeView1);
        }

        protected override void RenderContents(HtmlTextWriter writer)
        {
            //render treeview control
            TreeView1.RenderControl(writer);
        }

    }
}

Tuesday, June 23, 2009

SharePoint ULS logs are empty: 0 KB logs in 12 Hive logs

. Tuesday, June 23, 2009
1 comments

A few months back I decided that it was time to get rid of unnecessary SharePoint logs since I wasn't into development and event logs were coming sufficient. Just in case you guys are wondering how to enable diagnostic logs, here are the steps: -

1) Open central administration > operations. Click on 'diagnostic logging' under 'Logging and Reporting'.

2) Select 'no' for 'Customer Experience Improvement Program' and 'ignore errors' for 'error reports'. If you wish to throttle (restrict) the events captured, select from category and events to be captured in event logs and trace logs (12 hive).

3) Provide the location for storing these logs. I usually keep 5-10 log files of 10-30 minutes each; otherwise my disk becomes full. As a practice keep logs in a different disk then the MOSS/WSS installation so that disk full issues do not affect the service.

NOTE: there are two types of logs in 12 Hive logs folder (<local-drive>\Program Files\Common Files\Microsoft Shared\web server extensions\12\Logs). The ones sitting outside the GUID folders are used for debugging and called ULS (unified logging service) logs. The ones within the GUID are usage analysis logs.

======================================================================

Anyway, back to my original issue; I happily disabled the logs, however few weeks back decided to re-enable them. And what, did everything as described above and the log files hence created were empty. Hmm, mind boggling; didn't look like a permission issue; still haven' figured out yet; the logs were being constructed but were of 0 KB each; files were empty: -

Things to check in his situtaion: -

  • enough disk space.
  • check if WSS timer service and WSS tracing service are running. Restart them once again.
  • try throttling the events (though this is most unlikely to work out as a solution since you would be restricting logs; exactly the opposite); however it worked for me; I enabled Verbose logging in trace log category of diagnostic logging page and logs started filling up. Whew!! Thank goodness, at least I have some data in logs now. This is a very strange behavior, what you guys should check is if you are throttling anything; remove that selection. For example throttling error events when no errors are there would give empty logs.

If anyone has figured out the solution, do let me know as my system is behaving exactly the opposite. :)

 

 

Monday, June 15, 2009

Error: The IIS Admin service terminated with the following error. The system cannot find the file specified

. Monday, June 15, 2009
1 comments

Today when I started my server (WIN 2k3), it threw a 'Service control manager' error: 'Failed to start at least one or more services'. I checked Event viewer and found the following error.

image

Upon manually trying to start IIS Admin from MMC , same error was thrown. I googled and as expected found an article - http://support.microsoft.com/kb/332103 from Microsoft saying "reinstall IIS". Err.. Definitely not. There has to be some other way. Soon I stumbled upon this angelic post - http://www.iisworkstation.com/2008/07/troubleshooting-could-not-start-iis.html. You can refer to the same post or in case are unable to open it, find below the instructions to troubleshoot this issue.

1) IIS ADMIN service needs two files - 'metabase.xml' and MBschema.xml to start; they reside in C:\WINDOWS\system32\inetsrv. The first thing to check is if files are available, in my case 'metabase.xml' was missing. I vaguely remembered that chkdsk that ran last night had mentioned some corrupt metabase.xml. Hmm.. so the poor file was removed... The first thing I did was to stop automatic startup of IIS ADMIN service from services.msc.

2) Fortunately, C:\WINDOWS\system32\inetsrv\History maintains the 10 latest backups (by default) of metabase.xml and MBScheme.xml files. As instructed, I copied the most recent entry (by modified date).

image

and pasted it to C:\WINDOWS\system32\inetsrv. Then I renamed it to 'metadata.xml'. Next I went to services.msc, changed the startup mode of IIS ADMIN from manual to automatic and started it. Immediately I got some script error. hmm. ...anyways, I clicked on yes and continued;the service started successfully.

3) Next thing to do was to increase the number of history files saved (learn from the past as I periodically backup SAM, SECURITY, SOFTWARE AND DEFAULT) . As instructed I ran the following command from start > run.

cscript.exe adsutil.vbs set /MaxHistoryFiles "15"

Ntime when the system restarts the effects will take place (else manually restart the IIS ADMIN service again).

4) Next thing was to go to 'INETMGR'. All the websites were in stopped state. I manually started them and checked in IE if my SharePoint sites were coming up fine. Finally YES YES YES.

Hope it helps anyone who faces this issue. Thanks to the original post!!

Thursday, June 11, 2009

How to exclude a site from being searched within a particular site scope.

. Thursday, June 11, 2009
0 comments

If you want to prevent a site from being crawled at all, you can set the 'Search Visibility' to false within the site settings. For an entire site collection you need to set this for each site as 'search visibility' is a site feature. (site features > search visibility).

image

 

The preferred way is to create a crawl rule in Central Admin of MOSS.

image

But what if you do want your site to be crawled however don't want it to appear in search results within certain site scopes? Let us assume 'ALL SITES'.

well, quite simple!

go to Central admin > Shared services > search services > view scopes.

Open the 'all sites' scope in edit mode. create a new exclude rule for hostname. save changes and bingo. :)

Wednesday, June 10, 2009

Downgrade Windows Vista to Windows XP on Inspiron 1525

. Wednesday, June 10, 2009
3 comments

[Out of context from current blog's subject, but thought should share with you; so.....Last night, my brother's system completely crashed and resolved to never work again for 2 minutes at a stretch. Unfortunately poor thing was hit by a deadly virus (unknown of course) a month back (courtesy his best friend who suddenly decided to download a video file packaged with a treat).

We tried everything from setting the Dell Inspiron 1525 to factory settings, blah blah but nothing worked. So ultimately, it was decided that Vista's time is up! Yes!!!! I never wanted to reinstall Vista. hehehe (finally will try slip-streaming). yay!

We collectively agreed on making a fresh install of Windows XP (goo goo goo...); I located one of my old CDs and prayed it would work and yes it did :)

But what is this; as soon as the setup started I got hi by below error: -

image

"Setup did not find any hard disk drives installed in your computer". I am sure it is one of those old sticky errors that people encounter while downgrading to Windows XP or Windows 2003 Server.

Reason: The system has SATA hard drive whose drivers are missing in Windows XP installation. So what now? I googled and found the way out and this is what I am about to share with you guys today.

We need to somehow integrate the missing SATA drivers with Windows setup files and use it.

Task 1: Find SATA drivers for Dell Inspiron 1525

Luckily unlike my HP laptop, I didn't have a field day locating SATA drivers for above model. Go to http://support.dell.com/support/downloads/driverslist.aspx?c=us&l=en&s=gen&ServiceTag=&SystemID=INS_PNT_PM_1525&os=WLH&osl=en&catid=&impid. Select "Windows XP" from OS dropdown.

image

and Bingo, all the drivers are located at one good old page. :). As for initial Windows XP installation, all we need is SATA drivers. I downloaded the highlighted one. at times

image

Download this EXE file (http://ftp.us.dell.com/SATA/R182441.exe). Once downloaded, right-click on it and select 'extract files' (need WIN RAR). Provide a location like "C:\XP Drivers for Inspiron 1525\R166200". At times 'download' button doesn't work. In such a case, replace highlighted text with the value of 'fileID' mentioned in the address bar.

http://support.dell.com/support/topics/global.aspx/support/downloads/en/downloads_splash?c=us&l=en&s=gen&%7Emode=popup&file=238839

Task 2: Install NLITE for creating a new windows XP setup slip streamed with SATA drivers

If you're using non Vista OS like XP, 2k3 to perform slip-streaming go to http://nliteos.pcrpg.org/nlite/nLite-1.4.9.1.installer.exe; for VISTA users http://nliteos.pcrpg.org/vlite/vLite-1.2.installer.exe.

Remember you would need .NET framework 2.0 SP1 as a prerequisite in case on XP, WIN 2K3 and VISTA and an additional AIK Kit (heavy files) for VISTA. I used my server for creating set-up. :). Download and Install NLite/VLite.

Task 3: Slip-Streaming (integrating SATA drivers with Win XP Pro Setup)

Start NLITE. click Next until you reach below screen, Click on Browse button and select the root folder containing WIN XP setup (in CD/ or HDD if again creating a new image with old setup files). once done, you'll again get a screen, where you need to provide the location to extract win XP setup files to. call it - c:\WinXPISO.

image

Click Next. The setup files will start loading, when the progress bar finishes, you will get below screen.

image

Click Next until you reach below screen. Use 'ctrl' key to multiple select different options. I selected 'service pack', 'drivers' and 'bootable ISO'. Make sure you select at least 'drivers' and 'bootable ISO'. clik Next.

image

If you selected 'service pack' you'' get below screen. Click on 'Browse' button and locate the EXE for Service Pack (2 or 3) in this case. You can get WIN XP SP2 from here-http://www.microsoft.com/downloads/details.aspx?familyid=049c9dbe-3b8e-4f30-8245-9e368d3cdb5a&displaylang=en and SP 3 from here - http://www.microsoft.com/downloads/details.aspx?FamilyID=5b33b5a8-5e76-401f-be08-1e1555d4f3d4&DisplayLang=en

image

If you haven't selected service pack option, you'll be presented with below screen. Click Insert. Select 'single driver'.

image image

Locate the drivers folder (where you extracted SATA driver files in Task 1).

image

select One of the INF files and click Open, both will be selected anyhow.

image

select 'textmode driver' option. I selected the following highlighted drivers for my set up. Click on OK.

image

Click Next. Click Yes upon 'start process?' prompt. Once the process finishes, you've an option to either Burn the new setup files or create an ISO. I chose to create an ISO. select 'create image' and click on 'make ISO' button to start making ISO

image image

Once the ISO is created you can burn the image to a DVD. I used Roxio Easy CD creator. Now that the CD is ready, insert it in the VISTA laptop. I used hairpin to pull the CD tray out and place the CD in it.

On Inspiron 1525, Use F12 to get boot option and select CD/DVD option and proceed. I took the fancy of formatiing and repartitioning the entire HDD since Inspiron 1525 didn't allow more than 1 partition besides System and recovery partition.

Task 4: Get the Missing Drivers for Inspiron 1525

a) Notebook System Software (only for DELL)

http://ftp.us.dell.com/utility/R181862.exe

b) System Software (only for DELL)

http://ftp.us.dell.com/utility/Dell_System-Software_A03_R214472.exe

c) Mobile Chipset Drivers

http://ftp.us.dell.com/chipset/R166187.exe

d) Ricoh Flash Controller Driver

http://ftp.us.dell.com/chipset/R166188.EXE

e) Video Adapter Driver

In order to correctly identify your chipset download chipset ID utility from http://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&ProductID=861&DwnldID=13799. Mine is Intel GM965 Express Chipset Family.

I recommend searching for latest video drivers/ SATA HDD drivers on Intel rather than Dell -http://downloadcenter.intel.com/default.aspx.

For above mentioned chipset select http://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&ProductID=2800&DwnldID=17353&strOSs=44&OSFullName=Windows*%20XP%20Professional〈=eng

f) Network Interface Card (Ethernet Controller)

Marvell 88E80XX 10/100 Ethernet Controller at http://ftp.us.dell.com/network/R180046.exe.

g) Dell Quickset (only for DELL)

http://ftp.us.dell.com/app/R174191.exe.

h) Audio Adapter

Sigmatel STAC 92XX C- Major HD Audio Driver at http://ftp.us.dell.com/audio/R180044.exe

i) Modem Driver

Conexant D330,HDA,MDC,v.92,modem at http://ftp.us.dell.com/comm/R167368.exe

j) Wireless Network Card

WLAN driver for Dell Wireless 1395 WLAN MiniCard at

http://support.dell.com/support/downloads/download.aspx?c=us&l=en&s=gen&releaseid=R174291&SystemID=INS_PNT_PM_1525&servicetag=&os=WW1&osl=en&deviceid=9805&devlib=0&typecnt=0&vercnt=1&catid=-1&impid=-1&formatcnt=1&libid=5&fileid=236819.

k) Touchpad driver

http://ftp.us.dell.com/input/R180045.exe

l) Laptop Integrated webcam

This was the trickiest of all. At first I got the error " device driver does not support current OS version". After I installed WIN XP SP 2 I was able to run setup but it always ended in failure. After repeated attempts and trying to make the cam locate drivers using device driver manager somehow 'hardware was properly detected and installed ( magically :))

http://ftp.us.dell.com/input/R165116.EXE

m) Bluetooth

http://ftp.us.dell.com/network/R140135.exe

===============================

Umm...this should pretty much do! Stay tuned for the next blog and your comments are most welcome!

Wednesday, June 3, 2009

When publishing is enabled the ‘HOME’ tab is replaced with the parent site’s name

. Wednesday, June 3, 2009
1 comments

changing the content page’s name that appears on IE window.

· On the default.aspx page, search for

<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,multipages_homelink_text%>" EncodeMethod="HtmlEncode"/> -

<SharePoint:ProjectProperty Property="Title" runat="server"/>

· Replace <SharePoint:ProjectProperty Property="Title" runat="server"/> with the new title.

Changing the site’s home tab name: -

a) Rename the tab through SharePoint GUI as ‘HOME’

b) Open the master page, search for

<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/" id="onetidProjectPropertyTitle">

<SharePoint:ProjectProperty Property="Title" runat="server" />

</SharePoint:SPLinkButton>

c) Replace <SharePoint:ProjectProperty Property="Title" runat="server" /> with site’s actual name.

SharePoint content page throw error or take forever to open

.
0 comments

This might happen due to a faulty webpart like Content editor web part containing invalid content URL link.

SOLUTION: remove content URL from content editor webpart using SharePoint designer.

Error while closing/deleting webparts through SharePoint GUI

.
0 comments

Use SharePoint designer to close/delete them.

Activating the publishing feature throws error 'document library/list/survey already exists'

.
0 comments

SOLUTION: Delete the half created publishing related libraries/lists using SPD.

SharePoint Blog site - category filter does not work after editing

.
0 comments

Editing the Category.aspx page filter in a blog site breaks the category filter.

You change the default view of a category that filters the blog posts on a Microsoft Windows SharePoint Services 3.0 blog site. When you visit the SharePoint Services 3.0 blog site, and then you click the link for the category that you changed, the blog posts are not filtered correctly. Instead, all the blog posts are displayed.

SOLUTION:

a) Create a new blog site that uses the same language and categories as the broken one. We'll call this new blog site the "temp" site.

b) Use SharePoint Designer (SPD) to open both the broken and the temp site. You will have each site open in its own instance of SPD.

c) On both instances of SPD, expand the folder tree to Lists | Categories, and open Category.aspx in split mode.

d) On both instances of SPD, select the "Posts" Web part in the design view part of the spilt.

e) For the broken Category.aspx page, locate the <ListViewXML tag on the code section for the Posts Web part. Copy only the GUID from the "View Name= <GUID>" section.

f) Paste this GUID over the same place on the temp Category.aspx page. Here, you are swapping GUIDs, "broken" to "temp."

g) On the temp Category.aspx page, copy the entire code between the <ListViewXML... and </ListViewXML> tags.

h) Paste this chunk of code over top of the same <ListViewXML section of broken Category.aspx page. Here, you are swapping the entire ListViewXML section, "temp" to " broken."

i) Save the changes to the broken page.

j) Examine your broken blog site. It should be fixed now.

k) You can now delete the temp blog site. As a summary of these steps, you are copying the entire ListViewXML section for the Posts Web part on the temp site and overwriting the same section on the broken site. However, you have to keep the View Name GUID from the broken site so that you copy that to the temp site first.

This has now been officially recognized a bug by MS.

‘g_InstanceID’ is undefined' error in meeting workspace site

.
0 comments

In a meeting workspace site, clicking on the dates mentioned in the left panel gives a JavaScript error: -

Error: ‘g_InstanceID’ is undefined.

LEVEL: Advanced

The g_InstanceID global JavaScript variable is declared in a script registered runtime by the Microsoft.SharePoint.Meetings.PropertyBag web control. This control is used in the master page that’s used by Meeting Workspace sites called “MWSDefault.master” (located on server in 12 hive\TEMPLATE\GLOBAL\).

After changing the master page on a Meeting Workspace site, the recurring meeting workspace hyperlinks under “Select a date from the list below” do not work and throw a JavaScript error.

If you create a custom master page and use it for your Meeting Workspaces, a JavaScript error is thrown.

Steps to Reproduce:

Create a new Workspace: Site Actions-> Create Site -> Select [Meetings] Basic Meeting Workspace, click Create.

On Workspace site, add a Calendar list: Site Actions -> Create -> [Tracking] Calendar.

Add a new event to Calendar list, make recurring event, and select [x] Use a Meeting Workspace to organize attendees, agendas, documents, minutes, and other details for this event. Click OK.

Follow steps to create workspace for Calendar event. Go to workspace.

Change master page for workspace: Site Actions -> Site Settings -> [Look and Feel] Master page -> select any master page for Site Master Page and System Master Page. Click OK. Go back to workspace.

SOLUTION:

a) Open SharePoint Designer 2007.

b) Go to File | Open Site and connect to SharePoint site.

c) Expand out _catalogs -> masterpage -> open master page used on Meeting Workspace.

d) In Code View, add the following line of code under

<%@ Import Namespace="Microsoft.SharePoint" %> tag:

<%@ Register Tagprefix="Meetings" Namespace="Microsoft.SharePoint.Meetings" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

Add the following line of code after opening <body …> tag:

<Meetings:PropertyBag runat="server"/>

e) Save master page, check in (if necessary), and publish major version.

Now the links under “Select a date from the list below:” do not work and throw a JavaScript error message: ‘g_InstanceID’ is undefined .

'modification to stylesheets/master page' result in page error in SharePoint GUI.

.
0 comments

in case you're unable to determine what to correct, the best approach is to take a backup of the site and reset it to site-definition using SharePoint Designer.

'Server could not complete your request' ; 'soap: Serverserver was unable to process request' while opening a page in SharePoint designer

.
0 comments

image image

 

The error that you encounter often shows up when we try to open the file in Read-only mode without checking it out. Such errors are usually associated with incorrect master-page associations. In order to sort this out either correct the errors in the associated master-page or check-out the file and then try to open it.

Remember this could be one of the reasons of such errors and provided above is only a workaround.

'Invalid Master page' error while opening pages in SharePoint designer

.
0 comments

Adding a new master page that doesn’t reference all the content regions and hence throws invalid master page error

SOLUTION: This can only be corrected by attaching a new master page or setting the missing content regions appropriately.

'Edit Page' feature missing from Site settings menu.

.
0 comments

One edits the content pages and removes the web part zones containing web parts while keeping the web parts. This removes the option to edit the page/ removes option to edit the web parts.

SOLUTION: Add new web part zones engulfing the existing web parts.

Top Links added on a SharePoint site are not showing up for any user.

.
0 comments

Scenario:

Client has a SharePoint publishing site in which he tries to add top links for global navigation. In spite of adding them, they do not show up on the site.

Ticket Analysis:

Since this was a publishing site, it had a 'Pages' Library. This library ideally contains pages created using publishing layouts. Client had used this library to store aspx/asp/html pages created using SharePoint designer. As per the navigation settings, ‘Show Pages’ section was checked which showed pages from the ‘Pages’ library. One of these custom pages were throwing errors while rendering their links on the navigation  and hence the rest of the working top links refused to show up.

Solution:

I advised client to

1) Move these pages to some other library.

2) Use Pages library to only store publishing pages.

3) Until then, uncheck the 'Show Pages' option.

4) once done, top links started showing up.

New Pages added to meeting workspace do not appear as tabs to anyone but the author

.
0 comments

Issue: -

One adds a new page in a meeting workspace which appears as a tab. However it is visible just to the author of the page and not even to the farm admin.

 

image

 

This looks like a bug because not every workspace is affected. However it has not been confirmed by MS so far.

Cause: -

Every meeting workspace has a hidden library internally named (Pages) and externally as - Workspace Pages. All the pages created in a workspace are stored here. It is not accessible through 'View all site content' Page. This library has a field named - Title which is normally an optional field in working meeting workspaces. Apparently in above sighted cases, this field is 'Required' (unlikely event). When a page is checked in after being created all the required fields need to be populated. In normal cases we don't have any such field and hence (no issues during check-in) everyone can see the page once it is created.

However, In above cases/issue, we have a 'required' field named - Title which doesn't get populated automatically and hence the page remains in checked out state to the author.

The library named - Pages doesn't provide any view through which these columns could be populated. Hence we can say that By design they are not supposed to be populated by us. This is the primary reason that the author of these pages cannot check them in even by using SharePoint designer. One will get an error.

Resolution:

1) Un-hide this library in SPD. Right click on Pages library, select properties. Click on settings tab; uncheck 'hide from browsers'.

image

2) Now this library will be visible on GUI. Open it using 'view all site content' page. click on 'Title' column. select 'No'. click OK.

image

3) Every pages created afterwards would be visible to all users.

 

WHAT ABOUT THE PAGES CREATED PREIVIOUSLY??

The original page author needs to open the 'Pages' Library in SPD; make a copy of the checked out pages (created previously and invisible to all but author); paste the copy in the pages library; delete the original pages; rename the new copies with original names.

 

WHY CAN'T I COPY-PASTE THEM THROUGH GUI??

This would require us to browse to the Pages library view in GUI. However By design this library doesn't have any view. Though one gets an option to create view; however upon clicking OK, you will get an error. :)

Permissions needed to Create/Edit a Workflow

.
0 comments

A workflow is basically considered part of an entire site rather than a specific list or library. Full control over a list does not guarantee workflow creation permissions.

One needs to have either of MANAGE HIERARCHY or DESIGN permissions on the entire SITE in order to be able to create/edit workflows.

STSADM -- Activate Publishing/ Publishing activation - access denied error / Greyed out link - Modify Navigation

.
2 comments

stsadm -o activatefeature -filename publishing\feature.xml -url http://<site_url>/sites/Vogue -force

stsadm -o activatefeature -filename publishingresources\feature.xml -url http://<site_url>/sites/Vogue -force

stsadm -o activatefeature -filename publishingSite\feature.xml -url http://<site_url>/sites/Vogue -force (activating on site collection level)

stsadm -o activatefeature -filename publishingweb\feature.xml -url http://<site_url>/sites/Vogue -force (activating on root site level)

stsadm -o activatefeature -filename publishinglayouts\feature.xml -url http://<site_url>/sites/Vogue -force

stsadm -o activatefeature -filename navigation\feature.xml -url http://<site_url>/sites/Vogue -force

use stsadm command line utility when: -

  • Clicking on activate/deactivate link for publishing doesn't activate publishing on site/web level.
  • Activating publishing through SharePoint UI gives 'access denied' error.

Access denied error during publishing activation is due to the reason that Publishing Resources are not activated on MOSS firs installation. hence we can manually do it using this utility (see above commands).

At times, you will notice that a publishing site has a number of grayed out links in Site actions: for e.g. 'Modify Navigation'. I was able to replicate this issue, when I ran the first command from above list. Publishing was incompletely activated and hence modify navigation link was grayed out. As soon as I ran the second command (publishingresources) the option became available.

STSADM Export/Import and Backup/Restore

.
0 comments

Difference between SPD backup and backup using STSADM backup command

1) The Backup taken using SharePoint Designer (site > administration menu > back-up website) is equivalent to STSADM – o export. It creates a .CMP file as opposed to the STSADM –o backup command.

2) The export (backup taken using SPD) can be restored using SPD (‘site > administration menu > restore website) or using STSADM –o restore command (as opposed to STSADM – o backup).

3) If the export (backup through SPD) contains a column conflict, it shall not be able to perform successful restore using SPD> In that case do STSADM –o restore.

================================================

Backup/Restore can work either on the farm level or the site collection level. One cannot use this operation to backup/restore a subsite. For this we use Export/Import operation. It can work for site collections (top level site) as well as subsites.

Backup/Restore overwrites the entire site collection/farm. Hence old contents are removed.

Export/Import merges the contents during import.

Lessons learned while using the STSADM export and import commands:

1. Alerts will not follow the site's lists and documents during the export process.

2. Email enabled lists can be an issue when importing if the destination server is not properly configured for incoming email.

3. Any task or issues list imported that emails a user when they are assigned a task will no longer send emails.  You need to disable and then re-enable the functionality in the lists settings.

 

<<<<source: http://mphacker.spaces.live.com/blog/cns!8040CC624DDC5404!252.entry>>>>

BACKUP/RESTORE COMMANDS

For site collection backup

stsadm -o backup -url <URL name> -filename <file name> [-overwrite]

url -----A valid URL, such as http://server_name ------ URL of the site collection that you want to back up

filename ------ A valid file name for the site collection restore file, such as "Siteres.bak" ------- Name of the restore file

NOTE:: REMOVE '[' AND ']' WHILE SPECIFYING OPTIONAL PARAMETERS :)

-------------------------------------------------------------------------------------------------------------------------------------------------------------------

For site collection restore

stsadm -o restore -url <URL name> -filename <file name> [-hostheaderwebapplicationurl] <Web application URL> [-overwrite]

url -----A valid URL, such as http://server_name ------ URL of the site collection where you want to restore (should already exist)

filename ------ A valid file name for the site collection restore file, such as "Siteres.bak" ------- Name of the restore file (complete path of file created during backup)

 

EXPORT/IMPORT COMMANDS

stsadm -o export  -url <URL name> -filename <export file name>

   [-overwrite]

   [-includeusersecurity]

   [-haltonwarning]

   [-haltonfatalerror]

   [-nologfile]

   [-versions] <1-4>

   [-cabsize] <integer value>

   [-nofilecompression]

   [-quiet]

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

stsadm -o import

   -url <URL name> -filename <import file name>

   [-includeusersecurity]

   [-haltonwarning]

   [-haltonfatalerror]

   [-nologfile]

   [-updateversions] <1-3>

   [-nofilecompression]

   [-quiet]

Features - Import spreadsheet, explorer view, edit in datasheet etc. not visible in Extranet sites

.
0 comments

The reason these options like – ‘import spreadsheet’ and ‘edit in datasheet’ are unavailable on DMZ sites is because we use Forms Based Authentication (FBA) on them. Client Integration doesn’t work well with FBA and hence has been disabled. This feature provides access to above options. Other features like ‘explorer view’ and ‘open with access’ shall also remain unavailable owing to this.

Access denied while 'Create Page' action

.
0 comments

Users with create sites rights (manage hierarchy) should ideally be able to create Pages. However they receive 'ACCESS DENIED' while trying to do so.

 

Resolution: -

Give them contribute access on masterpage gallery.

'Object reference not set to an instance of an object' error for site collection admin

.
3 comments

Last night I received an issue wherein a site collection admin was getting the below error only on the home page of her site. We tried with all WFEs and even with a test user account but could not replicate the issue.

 

image

 

How I resolved it: -

Since she was a site collection admin, it was safe to give her full control anywhere. The home page was a publishing page that uses masterpages and page layouts. So I went to the master page gallery and provided her full control and bingo it worked ! Next day she again received the same error. One of our team member went into the checked out files section and took ownership of all her files. And shoot, this time he was able to replicate the issue. we did a simple Binary search and were able to find out the culprit file and took it our of the library. Next thing, client regained her access. :)

Error while checking out a file - "file does not appear to be checked out"

.
2 comments

If ever we see a situation where an implicit lock is active, going to “Edit Properties” on the document (which requires checkout) is the only way I know to get the actual NAME of the person with the implicit lock.

Now if the user comes back and says she has closed Excel we still need to check because Excel and Outlook might be in a zombie state (running in Task Manager Process tab, but without having any visible windows on the desktop)  In these rare cases the lurking EXE may still have the SharePoint file open over the network.  So even though the end user swears she is no longer editing the file, the Windows client may still have the fill open and would be continually refreshing, thus maintaining the implicit lock.  Sometimes we may need to have the end user reboot to release the zombie held lock.

 

NOTE:: The lock can be removed only by that user and only through the system used to place the lock.

Add a site in network places as a web folder

.
0 comments

There are times when we want to add a site as a new network place and browse our way around. The best way of doing this it to add the following URL in network place wizard: -

e.g. http://<site-name>/default.aspx

make sure you add default.aspx to the site name otherwise the site will be added as a normal folder (as in open in explorer view mode of SharePoint UI) and not in webfolder format.

Site added as a web folder.

image

Site added as a normal folder.

image

Read only users get a different page formatting, page view.

.
0 comments

There would be times when a site would appear different to site collection admins and the Read only users. The first troubleshooting step in this would be:-

 

1) Check if the home pages is properly published..

2) If yes, then check its master page and make sure it is published and approved. This will make the changes visible for all users.

3) Check if the images, stylesheets, etc. are not in minor version formats or draft formats.

4) If the page still appears different then make the following changes in the style library.

5) change the versioning settings of style library to show draft versions to users with read access.

6) Above step should be taken if the draft versions cannot be located and are rooted deep down in the library's hierarchy.

Change Stylesheet of a web part

.
0 comments

When we add a style sheet to webpart through code, it overrides the main stylesheet of the page. However there’s a workaround approach through we can restrict styles to only one webpart.

Every webpart has a Zone Cell Id reference “MSOZoneCell_WebPart_WPQ_”. The _WPQ_ portion is replaced by the webpartzone name during the execution of the code. This can be checked by viewing the source of the webpartpage. So it would become something like #MSOZoneCell_WebPartWPQ3.

Through view source property we can find the id of the webpart to which we want to add our styles.

Suppose our webpartpage has two webparts with a table each and we want to apply styles only to the second webpart. In usual cases the stylesheet, if supplied in the webpart code, is applied to the whole page, which is not required.

The solution:

1. What we can do is, to add a Content Editor Webpart, and supply the style definitions for that particular webpart in its source editor. This webpart can be hidden.

Now again if we supply a style something like:

<style>

TABLE

{

            font-weight: normal;

            color: navy;

            font-family: 'Bookman Old Style';

            background-color: #ccccff;

}

</style>

It would be applied to the whole page. The solution is that we can use the id of this particular webpartzone (MSOZoneCell_WebPartWPQ3).(it is fixed and can be obtained through view source property if the webpart page.

Hence we can have something like:

<style>

/*changes the header of the wbepart*/

#MSOZoneCell_WebPartWPQ3 .ms-WPTitle

{

    font-weight: bold;

    font-family: verdana, arial, helvetica, sans-serif;

    color: #00ccff;

    padding-left: 6px;

    padding-right: 7px;

    padding-top: 2px;

    padding-bottom: 2px;

    font-size: 8pt;

background-color: teal;

}

/*changes the body of this webpart only, if it contains any td tag.*/

#MSOZoneCell_WebPartWPQ3 .ms-WPBody TD

{

            border-right: thin groove;

            padding-right: 1px;

            border-top: thin groove;

            padding-left: 1px;

            padding-bottom: 1px;

            margin: 2px;

            border-left: thin groove;

            padding-top: 1px;

            border-bottom: thin groove;

}

#MSOZoneCell_WebPartWPQ3 .ms-WPBody th

{

    font-size: 8pt;

    font-family: verdana, arial, helvetica, sans-serif;

    background-color: #cc0033

}

/*since datagrid is rendered as a table , hence we can provide a custom class here for datagrid. This clas can be set as the cssclass of the datagrid in the webpart code.*/

.skynetdatagrid {

font-size: 12pt;

            color: silver;

            font-family: verdana, arial, helvetica, sans-serif;

            background-color: black;

}

.skynettable

{

            font-weight: bold;

            color: green;

            background-color: #ffccff;

}

</style>

Error while moving documents across site collections, sites - cannot read from source file or disk

.
0 comments

Using windows explorer one cannot drag n drop (cut-paste) documents across site collections.

If you try to cut-paste (drag-drop) documents across site collections or across sites in same site collection, you would get the following error: -

"cannot read from source file or disk"

WORKAROUND

1) Open the source and destination libraries as network places. (using add a new network place).

2) Browse to the document libraries in question.

3) Drag-drop the files.

4) There’ll be no error.

Things to check at client’s end: -

1) Check if Webclient service is running and is set to auto start in services.msc. Stop and restart it.

Workflow error - Failed to load the workflow

.
0 comments

Existing workflows when opened through SharePoint Designer throw the following error : -

Steps to be taken : -

1) Ensure if you always get this error or if it is intermittent.

2) In case of the latter, try creating new workflow and see if any of the ECF custom actions are missing from the list.

3) If yes, try pointing to all WFEs (in case of load balancing) currently servicing that web application and see if the issue is replicated.

Digital Signatures in Infopath form templates - self signing

.
1 comments

For internally developed applications, we would not want to buy digital certificates and sign the InfoPath form templates using them. Hence comes the concept of self signing the form templates. However this has to be used strictly for testing purposes only.

1) Download the Microsoft Platform SDK for Windows Server 2003 R2 from Microsoft site.

2) Use the makecert utility located in the C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin folder.

makecert -sk <key file store location name> -n "CN=TestCertificate for Himani" certificate1.cer -ss my -pe

3) Now the certificate will be available in the “personal folder. You can use signtool.exe’s signwizard to sign the form template with this certificate. You need to select the certificate from the personal store and select the private key store location.