Tuesday, May 26, 2009

From My Site to the Portal

Many people are asking “Why there is no link to go back from My Site to the portal?” and the answer is very simple, My Site may be shared between more than a portal, in this case which link you will display?

But still you can make a link to a preferred portal, go to Site Actions > Site Settings > Site Collection Administration > Portal Site Connection > then type the URL and the title for the portal you want the users go back to from My Site.

Monday, May 25, 2009

Absolute Paths in SharePoint

What if you want to add an image to your MasterPage that will be changed in each sub site, a logo for example, you can add an image tag like this:

<img src="../SiteImages/MyLogo.gif" alt="SubSiteLogo " />

This is fine when you are browsing a page in the Pages list (http://www.mysite.com/subsite/pages/mypage.aspx), but what if you are browsing an overview.aspx page for example for a Survey list (http://www.mysite.com/subsite/lists/surveyname/overview.aspx), you will need to change the tag to:

<img src="../../SiteImages/MyLogo.gif" alt="SubSiteLogo " />

So how to add the image tag to make it work for both pages?
The solution is to change your tag to this:

<img src="<% $SPUrl:~Site/SiteImages/MyLogo.gif %>" alt="SubSiteLogo" runat="server"/>

Where ~Site is your absolute current site URL

Okay, now what if this image is not changed per sub site, but it is changed per SiteCollection and the url is something like this: (http://www.mysite.com/anothersitecollection/subsite/pages/mypage.aspx), in my default SiteCollection I can make the tag like this:

<img src="/SiteImages/MyLogo.gif" alt="SubSiteLogo " />

But in another site collection this will not work with me, so I can make it like this:

<img src="<% $SPUrl:~ SiteCollection/SiteImages/MyLogo.gif %>" alt="SubSiteLogo" runat="server"/>

The same thing here with the stylesheet, you can do the same:

<link rel="stylesheet" type="text/css" href="<% $SPUrl:~Site/StyleSheets/MyStyle.css %>" runat="server"/>

Wednesday, May 13, 2009

Things to ask the client about before working on My Site

In a MOSS project the RSD may say: “out of the box My Site”, but you have to make sure that the system analyst has asked the client the below questions:

1. Do you really need My Site, or can the requirements be developed?
Sometimes the user just wants to display the user information, but he heared that there is something called MY SITE and he wants it.

2. What is the expected number of users that will create My Site?
The expected number of MY SITEs is very important, as it is a factor of space and performance, as each My Site is a site collection and the default quota is 100 MB for each site. I was working on a project for a big organization that has 15000 users, but for obviously not all of those users will create My Site.

3. Will all the users be able to create "My Site"?
Some organizations like the 15k users case, for obviously not all of them will be able to create My Site as some of them are contractors that are doing a task and will leave after two or three months and may be more, but they will not be allowed to create My Site.

4. Do we need the 100MB for each site?
100MB is a very large space, and may be very small for others, but the expected or the planed size is very important to make your hardware architecture regarding the performance and the storage space and the storage place (this is another question but you will need to answer it yourself, as you may need to create a group of My Sites that belong to a group of users in a place and another group in another place).

5. Do you have only one AD domain or more?
More domains means that a username may be duplicated, so you must configure the settings to take the domain name in site URL, not just the username.

6. What is the authentication type of the OWA, In Case you will use Outlook webparts?
You will need to know this, as the forms authentication will display the login window inside each webpart iframe with a scroll if the webpart size is smaller, you may decide to pass the credentials using JavaScript and submit the form (you have to configure the trusted sites in the browser and make the OWA and the intranet site on the same domain but using a different sub-domains) , also what is the used version of the Exchange Server

7. Is the email address the same as the username?
Some organizations are using username like domain\usr24hr and the email for this user is ramy.fawzy@domain.com for security reasons. In this case take care while working on customizing Outlook webparts automatically to set the exchange server address and the email inbox name.

8. Will you allow the user to select his "My Site" language or not?
In multiple language websites it may be a needed to allow the user to select his My Site interface language. The client may imagine that it can be English/Arabic the same as his portal for example.

9. Do you need to customize in the layout or not?
Some customers ask for My Site, but they don ‘t know that it will not inherit the portal MasterPage, and they will be shocked after the site deployment, so make it clear from the beginning for him and for yourself.

Wednesday, May 06, 2009

Listing Folders, SubFolders and Items in one page

It was requested from me to make a page in MOSS that will display Departments in an organization, and there is a set of sub departments and in each sub department there may be another group of sub departments and then a list of file library that may also be divided into groups.

I want to save all these files in only one document library but divide them into folders and subfolders as required, and make the minimum number of pages and code to display these folders and items and without any .net coding.So my solution is to make a page in SharePoint designer and add a DataSource and a DataView then make the following steps:

1. In the SPDataSource add Scope="RecursiveAll" this will make the datasource get all the items (folders and documents) not just the folders in the first level.

2. Add parameter to the DataView, ex. Name: FolderPath, Source: QueryString, QueryStringVariable: FolderPath, DefaultValue: En/DownloadCenter/Documents (which is the path to your document library)

3. Make a filter in the DataView to have Path, Equals, [FolderPath]

4. Make a variable to be used as the page link or the document link as:

<xsl:variable name="url">
<xsl:choose>
<xsl:when test="@ContentType = 'Folder'">documents.aspx?FolderPath=<xsl:value-of select="substring(@FileRef, 2)">
</xsl:value-of>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@FileRef"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>

5. The above code will check if the item is a folder so we will need the link to redirect to the same page (documents.aspx in our case), and if the item is a document so we need to redirect to the document URL.

6. substring(@FileRef, 2) is used to remove the first / character in the URL Path (not the Path), to know what is the difference between both, Path: En/DownloadCenter/Documents, URL Path: /En/DownloadCenter/Documents/Subfolder1