Something old…

This is not new but it’s oft forgotten…

Every now and then when working with SharePoint you’ll notice that you do not have access to the “Edit Page” function via the “Site Actions” button.
Simply add “&ToolPaneView=2″ to the querystring of the URL (/Forms/DispForm.aspx?ID=1&ToolPaneView=2).

SharePoint: Multiple databases for 1 Web Application

This process makes assumptions that the SharePoint environment is in a very exact state. Specifically that:
• All databases other the one currently being used for new MySites are in an offline state and that there is only ever one Web Application available.
• There is a defined business need for a series of smaller databases rather than one large and potentially unwieldy one.

When a database in SharePoint is in an offline state it is not in an inaccessible mode but rather it is not viewed as a tenable location by the process that creates new site collections. Instead SharePoint will look at the delta on the current number of sites value versus the set maximum in any and all other open Content Databases and select the one with the greatest value.

To set a content database status to offline:
1. Go to “Central Administration > Application Management > Content Databases”
2. Then click on the database of your choice set it to “Offline”

To create a new database for every new site collection the following steps need be followed.
1. Create a new content database.
a. Start the SharePoint Central Administration Web site.
b. On the Application Management page, in the SharePoint Web Application Management section, click Content databases.
c. On the Manage Content Databases page, click Add a content database.
d. On the Add Content Database page:
e. Select a Web application for the new database.
f. Select a database server to host the new database.
g. Specify the authentication method the new database will use and supply an account name and password if necessary.
h. Specify both the total number of top-level sites that can be created in the database and the number at which a warning will be issued.
i. Click OK.
2. Create the new Site Collection.
3. Set the newly created content database status to Offline.
4. View the contents of the new content database to confirm that it only contains what it should. (In theory a new My Site could be in there.)

It is important to confirm that this new database is appropriately accounted for by backup and DBA maintenance routines.

If a site collection was errantly created during the period that the new content database was online it can be moved as follows:

1. Run the following stsadm command, to get a list of all the sites in the web application

Stsadm -o enumsites -url <URL> > <path/file name>.xml

Where:
• <URL> is the address of the Web application that contains the site collection that you want to move,and
• <path/file name> is the name of the XML file that you want to create with the site collection data.

(Example: stsadm -o enumsites -url http://localhost > c:Sites.XML)

Open the XML file that you created in a text editing application. If there are any URLs for site collections that you do not want to move, be sure to delete them from the file. The only URLs that should remain in the XML file should be for the site collections that you want to move.

Note: There is no need to change the site count or any of the other site collection information in the file. Only the URLs are relevant to this procedure.

2. Run the following stsadm command:
Stsadm -o mergecontentdbs -url <URL> -sourcedatabasename <database name> -destinationdatabasename <destination database name> -operation 3 -filename <file name>

Where:
• <URL> is the address of the Web application that contains the site collection that you want;
• <database name> is the name of the database that you want to move the site collection from; and
• <destination database name> is the name of the database that you want to move the site collection to;
• operation 3 is the “Read from file” operation; and
• <file name> is the name of the file that you created in step 4.

(Example: stsadm -o mergecontentdbs -url http://localhost -sourcedatabasename WSS_Content -destinationdatabasename WSS_Content2 -operation 3 -filename c:Sites.xml)

Note: This step assumes that all of the sites in the Sites.xml file where in the source database name. If the sites are located in multiple databases you may need to repeat these steps for each source Content Database.

3. Restart IIS by typing the following command, and then pressing ENTER: iisreset /noforce.

Custom Images for SharePoint profile page view

Sometimes you need to tightly control profile pictures in MOSS / SharePoint 2007. An easy way to do this if your pictures have the right naming convention is as follow.

Looking at the URL of the profile we can see that the data is clearly sent “/Person.aspx?accountname=DOMAIN%5JohnDoe” In this case we are looking at the domain user JDoe aka John Doe on the domain DOMAIN.
Edit person.aspx and at about line 39 comment out “
And replace it with the following JavaScript…


< type="text/javascript">
var str1=”< propertyname="FirstName" runat="server" preview="FirstName" values="<P N='PropertyName' T='FirstName' /><P N='ControlStyle'><P N='Font' ID='1' /></P><P N='Font' R='1' /><P N='ID' ID='2' T='ctl02' /><P N='Page' ID='3' /><P N='TemplateControl' R='3' /><P N='AppRelativeTemplateSourceDirectory' R='-1' />">“;
var str2=”< propertyname="LastName" runat="server" preview="LastName" values="<P N='PropertyName' T='LastName' /><P N='ControlStyle'><P N='Font' ID='1' /></P><P N='Font' R='1' /><P N='ID' ID='2' T='ctl03' /><P N='Page' ID='3' /><P N='TemplateControl' R='3' /><P N='AppRelativeTemplateSourceDirectory' R='-1' />">“;
str1 = str1.replace(“<>“, “”);
str1 = str1.replace(“< /span>“, “”);
str2 = str2.replace(“<>“, “”);
str2 = str2.replace(“< /span>“, “”);
document.write(“< src="'http://people/FirmDirectory/FacebookPictures/" alt="'" width="'72'"> <>“);
< /script>

(In this case our images have the following naming convention FirstLast.gif.)

As usual HTML tags have been changed in the following way:
“<" is now "< ".

SP2010 seeing more than “An unexpected error has occurred”

Anybody who works with SharePoint has seen the following “Awesome” message…

An unexpected error has occurred

There’s more detail to be had with a simple tweak of the web.config in both MOSS SharePoint 2007 and SP2010.

Navigate to your virtualdirectory, typically here: c:inetpubwwwrootwssVirtualDirectories and then to the folder for your web application.

Opening the web.config in Notepad++ or any other editor and search for the following tags (there is only one of each):

  • CustomErrors
  • CallStack

Note: change them to the below:

  • CustomErrors=”Off”
  • CallStack=”true”

How to: Hide the “View All Site Content” link in MOSS

You can hide this particular link from all but those users with full control over a WSS site rather easily.

  • Open the site master page in SharePoint Designer and find the SPSecurityTrimmedControl element.
  • The PermissionsString attribute of the SPSecurityTrimmedControl element determines what users can view this content. Change the value of this attribute to ManageWeb and only those users with rights to perform all admin tasks on the site will then be able to see the link on all pages in the site.
  • Save and reload!

SharePoint 2007: How to show and link to an attachment in a list

Get to the field in the view and put this in. Should work without a hitch… The usual change from “<" to "< " has been made. < name="SharePoint:AttachmentsField">
< name="runat">server< /xsl:attribute>
< name="ListId">
{LIST GUID HERE}
< /xsl:attribute>
< name="FieldName">Attachments< /xsl:attribute>
< name="ControlMode">Display< /xsl:attribute>
< name="Visible">true< /xsl:attribute>
< name="ItemId">
< select="@ID">
< /xsl:attribute>
< /xsl:element>

Display RSS with JavaScript in SharePoint

Displaying RSS feeds is a nice thing to be able to do. One way to do this is with JavaScript in a Content Editor Webpart. Code example below… As usual “<" has been replaced with "< ". < id="feed-control">
< style="color:#676767;font-size:11px;margin:10px;padding:4px;">Loading…< /span>
< /div>

< !-- Google Ajax Api -->
< src="http://www.google.com/jsapi?key=notsupplied-wizard" type="text/javascript">< /script>

< !-- Dynamic Feed Control and Stylesheet -->
< src="http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.js" type="text/javascript">< /script>
< type="text/css">
@import url(“http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.css”);
< /style>

< type="text/javascript">
function LoadDynamicFeedControl() {
var feeds = [
{title: ‘Feed Items’,
url: ‘http://coreboarder.blogspot.com/feeds/posts/default?alt=rss’
}];
var options = {
stacked : true,
horizontal : false,
title : “Preview”
}

new GFdynamicFeedControl(feeds, ‘feed-control’, options);
}
// Load the feeds API and set the onload callback.
google.load(‘feeds’, ‘1’);
google.setOnLoadCallback(LoadDynamicFeedControl);
< /script>

How to force deletion of a SSP stuck in unprovisioning state

Sometimes things go wrong with the SSP (life without it in SharePoint 2010 shall be interesting…) If you have one that will not delete, gets stuck in an “unprovisioning state”, cannot be opened or similar try this extra flag:

“Stsadm -o deletessp -title SSPNAME -force“.

The -force will normally delete the entry even if there are errors occurring.

Normally.

IF you’ve worked with SharePoint for any amount of time you know that is not always the word one would use to describe your experiences. Sometimes that command just does not work and you end up with a lingering SSP. To resolve you need to identify the GUID for the problem SSP and use STSADM -o deleteconfigurationobject -id “id retrieved from object table” to remove this/these item/s from the configuration database.

What’s the GUID? Use the following procedure to identify the Shared Services GUID:

  1. Login to the SQL server.
  2. Open SQL Management Studio and expend Databases.
  3. Expand Configuration Database & Tables.
  4. Open table for dbo.object.
  5. Execute the following query in query analyzer: SELECT * FROM [SharePoint_Config].[dbo].[Objects]where name like ‘%SharedServices%’ The results should look like this:

    A2B1EC50-7134-40D1-9D97-0D54E129AE70   1AAB936C-E65C-4829-9683-5CCF5BAB90B0   3ACD71A5-B35A-44F1-B524-F90FFEA1AACE   SharedServices1_Search_DB

    7BB6D64A-E954-4E55-B7CE-15F9AA071748   FB6E9959-5209-44FB-83A4-0A51C31F7A02   3ACD71A5-B35A-44F1-B524-F90FFEA1AACE   SharedServices2_DB

    A9013685-0830-43A9-925A-7875A10DDA82   9D95E78B-FA6F-4349-AD9A-43BD3EF44E99   43DAD086-2C32-4ECF-B545-9FC63D80698B   SharedServices2

  6. Copy the ID of object referenced in objects table of configuration database.
  7. Open command prompt and changed directory to C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN> and executed following command to delete the Shared Services using the ID which was copied: Stsadm -o deleteconfigurationobject -id “id retrieved from object table”