Wednesday, January 26, 2011

Quick Launch (left navigation) Missing in Web Part Pages - Solutions

In SharePoint 2007, When we create web part page, it doesn't come up with left navigation! SharePoint quick launch missing in web part pages!!
sharepoint quick launch missing

Well, There are 3 approaches to resolve this issue.
  1. Editing the Site definition Template files - Farm level (NOT RECOMMENDED!)
  2. Editing the Master page - Site level
  3. Editing the individual page - Page level
Editing the Site definition Template files - Farm level
in the WFE(s), Navigate to : "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\STS\DOCTEMP\SMARTPGS"

sharepoint 2007 quick launch missing
Open the files spstdX.aspx and comment out these lines:

<asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderNavSpacer" runat="server"></asp:Content>


In case you need the Place holder Image for the site, then you can add that by
<asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server">
<div style="padding:20px 0;">
<img alt="" width="150" height="50" src="/_layouts/images/generic.png" /></div></asp:Content>
</asp:Content>
<%--<asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderNavSpacer" runat="server"></asp:Content--%>


Editing the Master page - Site level, to solve sharepoint quick launch bar missing issue:
Open the site in SharePoint Designer, Edit your master page , it would be "default.master" by default.
Find the following 2 segments of code:
<asp:ContentPlaceHolder id=”PlaceHolderLeftNavBar” runat=”server”>
      .
      .
      . 
      .
 </asp:ContentPlaceHolder>

<asp:ContentPlaceHolder id=”PlaceHolderNavSpacer” runat=”server”>
      .
      .
      .
      .
</asp:ContentPlaceholder>


All you have to do is: Move the closing tag </asp:ContentPlaceHolder> right after the opening tag. for e.g.:

<asp:ContentPlaceHolder id=”PlaceHolderLeftNavBar” runat=”server”>
</asp:ContentPlaceHolder>
       .
       .
       .
       .


Save and publish your Master page.


Editing the individual page - Page level to fix SharePoint 2007 quick launch missing:
Open the Page in site in SharePoint Designer, Find the line :
<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"></asp:Content>

and comment or Remove it! In Case, you are getting some consistency in page width, try removing these place holder too.

<asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderNavSpacer" runat="server"></asp:Content>


and finally, our web part page will have Quick launch :-)
sharepoint quick launch bar missing

Some times, You may feel the Quick launch width is not enough! Here is the fix:

Add this css: just below:
<asp:Content ContentPlaceHolderId="PlaceHolderTitleAreaClass" runat="server">
 
For SharePoint 2010 quick launch missing issue, refer: Show Quick Launch in SharePoint 2010 Web Part Pages

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Monday, January 24, 2011

DisableLoopbackCheck - 401 Unauthorized / Repeated Login Prompts and Resulted Blank Page - Host Header Issue

Problem: Couldn't Access a local SharePoint site from the server! 

Today, I setup my new SharePoint 2010 development box. I made the machine as domain controller: "Crescent.com". Machine name was: SharePoint. After I installed SharePoint in port 80 I was accessing the SharePoint site at URL: http://sharepoint. Then I wanted to access the SharePoint as: http://teamsites.crescent.com. So I created a Host record in DNS.

Once I get the URL in the browser, it was asking me the password again and again. Finally it gave the 401 unauthorized error. (In an another case, SharePoint prompted for login credentials for three times and gave blank page!) hmm.. what's wrong with SharePoint?

Also found, SharePoint sites are not opening when you login to SharePoint server(WFE, typically) but opening elsewhere!

Solution:
Here the problem was: we need to disable the LoopBackCheck. Here is what I did.

To set the DisableLoopbackCheck registry key, follow these steps:
  1. Click Start, click Run, type regedit, and then click OK.
  2. In Registry Editor, locate and then click the following registry key:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
  3. Right-click Lsa, point to New, and then click DWORD Value.
  4. Type DisableLoopbackCheck, and then press ENTER.
  5. Right-click DisableLoopbackCheck, and then click Modify.
  6. In the Value data box, type 1, and then click OK.
  7. Quit Registry Editor, and then restart IIS.

DisableLoopbackCheck with PowerShell
Why not PowerShell? Lets use PowerShell to Disable Loopback Check, so that it can be faster. Fire PowerShell console and enter:
New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck" -value "1" -PropertyType dword​
Or the secured way:
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters' -Name DisableStrictNameChecking -Value 1 -PropertyType "DWord"
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0' -Name BackConnectionHostNames -PropertyType MultiString
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0' -Name BackConnectionHostNames -Value "intranet.crescent.com"
KB: http://support.microsoft.com/kb/896861

This fix applies for Host headers with Local SharePoint instances. In an another case, this was due to browser setting: "Enable Integrated Windows Authentication"

BTW, If your account has been locked out in AD or you supplied wrong User ID/Password, Your Password Expired or your Account is locked out, You will face the similar issue!


You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Sunday, January 23, 2011

SharePoint Error: "Access to this Web site has been blocked. Please contact the administrator to resolve this problem."

While trying to get a site collection in browser, It gave me this error: "Access to this Web site has been blocked. Please contact the administrator to resolve this problem."

Access to this Web site has been blocked. Please contact the administrator to resolve this problem

Root cause:
I understand, the site collection is being locked out! wanted to unlock by going to Central Admin web site. Central Administration > Application Management > Site Collection Quotas and Locks and select Not locked. but that also resulted an error.
hmm.. SharePoint doesn't allowed me to unlock the site via Central Admin.

Solution: Unlock the site collection using STSADM
stsadm -o setsitelock -url <site-collection-url> -lock none

Unlock the site collection using STSADM
Yeah, This resolved my issue and got the site back.

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


"This report failed to load because session state is not turned on" - Access Services issue in SharePoint 2010

When I configured my first SharePoint 2010 sandbox, I tried creating access services and received below error:
"This report failed to load because session state is not turned on" - Access Services issue in SharePoint 2010

So, its telling us to enable Session state. isn't it?

How to Enable Session State for SharePoint 2010:

  1. Open SharePoint 2010 Management Shell
  2. Type in the following cmdlet: Enable-SPSessionStateService
  3. Provide values for the following parameters:
  4. Type in the Database Name as "SP2010_Farm_Access_Service" (DatabaseName: SP2010_Farm_Access_Service) – This will create a new database in SQL names SP2010_Farm_Access_Service
  5. Do an IISReset
  6. Now, the Access reports should work!

KB: http://support.microsoft.com/kb/2419469/

Verify the following thing if you still get errors in access services in sharepoint 2010:
  • Access Services is installed part of the SharePoint 2010 Enterprise CAL
  • Make sure Service Infrastructure is enabled
    • Manage Services on Server - Access Database Service is started
    • Manage Services Applications - Review the Settings, No need to change any performance tuning settings
    • Manage Web Applications - Make sure application is associated with the Access Servic
  • Make sure all the features are activated
    • Central Admin -> System Settings -> Manage Farm Features -> Access Services Farm Feature
    • Central Admin -> Manage Web Applications -> Select Web Application hosting the Access Services Site -> Manage Web Application Features -> SharePoint Server Enterprise Web application features
    • Site Collection -> Site Settings -> SharePoint Server Enterprise Site Collection features
    • Site Collection -> Site Settings -> SharePoint Server Enterprise Site features
  • To the Access Reports on the web, Access Services requires
    • SSRS Add-in for SQL Server 2008 R2 (It doesn’t require SQL 2008 R2)


You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Friday, January 21, 2011

MOSS 2007 Style Breadcrumb for SharePoint 2010

SharePoint 2010 provided a new breadcrumb feature... But for the consistency sake on internet sites we may need to go for MOSS 2007 style breadcrumb. so here I'm explaining How to get MOSS 2007 style breadcrumb on SharePoint 2010.
moss 2007 style breadcrumb sharepoint 2010
So, Here are the steps:
  1. Open your Master page in SharePoint designer. Search for "PlaceHolderGlobalNavigation"
  2. Select the complete tag and delete! ( just place your cursor either in beginning or end of the tag <asp:ContentPlaceHolder id="PlaceHolderGlobalNavigation" runat="server"> and then choose "Select tag" from the context menu.)


3. Now search for "<div id="s4-mainarea" class="s4-pr s4-widecontentarea">" and then paste the below code just above the <div id="s4-mainarea" class="s4-pr s4-widecontentarea">

<div class="MOSS-Style-breadcrumb">
    <asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server">
        <asp:SiteMapPath SiteMapProvider="SPContentMapProvider" id="ContentMap" runat="server"/>
    </asp:ContentPlaceHolder>  
</div>

Finally, to give me the complete look and feel, we'll give some CSS touch. Paste the below CSS code just above the </head> tag of the Master page.

<style type="text/css">

.MOSS-Style-breadcrumb
{
   padding:5px 0px 5px 5px;
   font-family: Arial sans-serif;
   font-size:8pt;
   font-weight: normal;
   background-color: #EEE;
   border-bottom: 1px #CCC solid;
}

</style>

Here is our output:



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


SharePoint 2007 Search Issues

Error:  
"The search service is currently offline. Visit the services on server page in sharepoint central administration to verify whether the service is enabled. This might also be because an indexer move is in progress"
 

Here is the Fix:
  1. Open central admin >> Operations
  2. Go to Services on server and located your index server
  3. On "Office SharePoint Server Search" click "Stop". This reconfigures it.
  4. Now click "start"
  5. Then click "Shared Services Administration", hover over the failing SSP and select edit.
  6. You will notice now the indexer is not selected. Select it from the drop down.
  7. The server you have selected is probably the same server as you used before. If it is, go to that server and locate the indexer files. It is in the text box right below the drop down you just used.For me it was "C:\Program Files\Microsoft Office Servers\12.0\Data\Office Server\Applications". There you will find a folder with GUID, At the end of that folder add
    "-old". Now go back to your SSP and click OK. Wait for a minute and the index will recreate the GUID folder.
  8. That's all. Fixed

Error:

"No index file path" here is the way to set Index File Path externally when
it is not coming for an Existing SSP stsadm.exe -o editssp -title <SSP_Name>
-indexserver <index_Server_Name> -indexlocation "E:\Index\Office Server\Applications"
-ssplogin <SSP APP POOL account> -ssppassword <Password>
To resolve this for
new SSP here are some references:

How do I solve the "no indexers" problem in SharePoint central admin:

  Follow this article for the remedy: http://www.cjvandyk.com/blog/Lists/Posts/Post.aspx?ID=96

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Monday, January 17, 2011

Move SharePoint Site Collections between Content Databases

In SharePoint 2007 content databases can grow till 100 GB. What if you want to move your existing sites to a new content db?

Well, Here is the manual way to move site collection to a different database in SharePoint 2007:
  • Backup and Delete the Site Collection
  • Set all your Content Databases' maximum allowed sites to the number of current sites.
  • Set the Content Database you want the Site Collection to go into to allow one more Site Collection.
  • Restore the Site Collection
  • Adjust your Content Database maximums to allow new sites to be created. 
SharePoint 2007 move site collection to another content database - STSADM way:
You need to know your source DB, where your site resides first. How do we know what is the content db for a particular site collection? well, you can retrieve that information by running the stsadm command. Here is the command:
stsadm -o enumsites -url http://webapp_host_header > c:\sites.xml

Now, we've got and decided our source and destination DB's. ready to move the site? Here you go

stsadm -o mergecontentdbs -url http://web_App_URL -sourcedatabasename <Source DB Name> -destinationdatabasename <Destination_DB> -operation 3 -filename c:\output.xml

Move site collection to another content database in SharePoint 2010 / SharePoint 2013 using PowerShell:
Move site collection to another database in SharePoint 2010-2013, you can use the PowerShell cmdLet- Move-SpSite
Move-SPSite <URL of sharepoint site-collection> -DestinationDatabase <DB-Name>

Another nice way to move SharePoint Site collections between Content Databases: Use SharePoint Admin Tool kit - http://www.microsoft.com/downloads/details.aspx?familyid=BE58D769-2516-43CB-9890-3F79304528FF

It provides central Administration UI to move SharePoint site collection from one database to another


In case, you want to move the sites between Farms, You will have to backup/restore or export\import to move site collections.

Its always a good idea to take backup before doing these operations :-)

Technet article on mergecontentdbs: http://technet.microsoft.com/en-us/library/cc262923%28office.12%29.aspx

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Sunday, January 16, 2011

Error when trying to export a Sharepoint list to Ms-Access Table

When I tried to export a SharePoint list to Access table: 

I got the below error message.
"You do not have the necessary permissions to use the '{GUID}' object. Have your system administrator or the person who created this object establish the appropriate permissions for you".

"You do not have the necessary permissions to use the '{GUID}' object. Have your system administrator or the person who created this object establish the appropriate permissions for you".

This is because: List contains a column name that has more than 64 characters. Access 2007 database engine disallows columns that have names that contain more than 64 characters.

Solution: use only column names that contain less than 64 characters in SharePoint lists.


KB Article addressing this issue: http://support.microsoft.com/kb/924739

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


SharePoint WSP Solutions and Features Deployment using STSADM, PowerShell

In this article I'm documenting the Deployment of WSP files using STSADM and with the PowerShell.

Before we begin, Its a good idea to add STSADM's path ("C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\") to the environment variable "Path". It saves the typing :-)
and of course, its a good idea to have a Batch file for these activities.

It includes following steps:
  • Step 1: Add Solution to SharePoint Farm
  • Step 2: Deploy Solution
  • Step 3: Activate Solution features
Add the solution:
stsadm -o addsolution -filename <Path to the WSP file> say for eg. "C:\Deployment\myWSP.wsp"

Deploy the solution:
stsadm -o deploysolution -name <Path to the WSP file> -immediate -allowgacdeployment  -url <URL>   say for e.g. "C:\Deployment\myWSP.wsp"

On installing/Activating/De-Activating/Uninstalling the Features, following command shall be used:
stsadm -o installfeature -filename <FeatureFolder>\feature.xml

Activate the feature:
stsadm -o activatefeature -id <FEATUREID> -url <URL> -force

Deactive the feature:
Stsadm.exe -o deactivatefeature -filename “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\MyFeature\feature.xml” -url <URL>

Uninstall the feature:
stsadm -o uninstallfeature -filename “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\MyFeature\feature.xml”

Please note: if you are deploying a feature alone(with out WSP) you need to deploy the feature in ALL of the WFE's.

Retract Solution:
stsadm -o retractsolution -name <Name of the solution>

The GUI way:

Navigate to Central admin > Operations > solution Management

Select your WSP file to deploy, click on "Deploy solution", click "OK" that's All!

Here is the PowerShell way:
Fire the SharePoint 2010 Management Shell and type the following commands:

TO Add a New WSP:
Add-spsolution <Path to the WSP file> say for eg. "C:\Deployment\myWSP.wsp"

To deploy the WSP:
Install-spsolution –identity <Path to the WSP file> –gacdeployment

Deploy the WSP for a specify a URL:
Install-spsolution –identity <Path to the WSP file> –webapplication http://spsite –gacdeployment

In SharePoint 2010:
---------------------
Navigate to : Central Administration > System Settings > Manage Farm Solution

Select your WSP file to deploy, click on "Deploy solution", click "OK" that's All!

Here is the Technet article for the complete reference:
http://technet.microsoft.com/en-us/library/cc263231%28office.12%29.aspx

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Saturday, January 15, 2011

Insert a custom webpart in Master page

For a Intranet SharePoint site, I had a requirement to insert a custom Search we bpart  in Master page, just below Quick launch section.
Insert a custom webpart in Master page

But we can’t add a webpart zone into Master page, So I used this trick. In master page, there is a content place holder: <asp:ContentPlaceHolder id="PlaceHolderLeftActions " runat="server"></asp:ContentPlaceHolder> , So I placed the SAME ID for my web part zone in the Page layout/Page, So that in run time, The Master Page's content on PlaceHolderLeftActions will be replaced by the content page.

<asp:Content ContentPlaceHolderId="PlaceHolderLeftActions" runat="server">
<WebPartPages:WebPartZone id="g_A66B59618EF44FE89FCE36DA164B9CC5" runat="server" title="Zone 1">
</WebPartPages:WebPartZone>
</asp:Content>

In simple steps:
1. Create a Blank .Aspx page with SPD
2. Just insert the code as per the below screenshot

<asp:ContentPlaceHolder id="PlaceHolderLeftActions " runat="server"></asp:ContentPlaceHolder>

3. Now attach the master page, and then insert the desired webpart.

Same way, If you want to insert a webpart in Master page, you can use the same Technique, insert your own Tag in Master page and replace the content in your content page by assigning same tag.
<asp:ContentPlaceHolder id="MyTag" runat="server"></asp:ContentPlaceHolder>

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Limit Versioning and Delete Old Versions in SharePoint

In one of my SharePoint Implementation, Defined the governance policy for versioning as: "Only 5 Major and 5 Minor versions should be kept.". So placed that in End user self service Portal site. But who cares? users setup up their document libraries/Lists to unlimited number of versions, and asking for Increasing the Site quota quite often.

On analyzing the site space figured out: For a 1GB site, versions are occupying nearly 300MB!!! So, wanted to clean-up the versions except last 5 minor/Last 5 Major.

Oh, Yeah, to set versioning limit in SharePoint, Just get into the List/Library settings > Versioning settings then setup the versioning limits.
Limit Versioning and Delete Old Versions in SharePoint

Quite simple, Isn't it? Ah, but user has 100+ libraries where unlimited number of versions enabled! OMG!!!

Limit number of versions in SharePoint with PowerShell
PowerShell comes to rescue again! Here is the code to delete the older versions, except last 5 major and minor.

$SPsiteCollection = Get-SPSite "http://SharePointSite.com"  
    # Loop through all Webs in the Site Collection  
    foreach($SPweb in $SPsiteCollection.AllWebs)   
     {  
        # loop through all lists in web
   foreach ($SPlist in $SPweb.Lists)
       {  
  if($SPlist.EnableVersioning=$true)
          {
   write-host "Setting versioning Limit for :" $SPlist.title 
                 $SPlist.MajorVersionLimit = 5;
   # To Disable Versioning use: $SPlist.EnableVersioning=$false
   # To Enable Minorversion: $SPlist.EnableMinorVersions = $true;
   # Minor version Limit:  $SPlist.MajorWithMinorVersionsLimit = 5;

                 $SPlist.Update();
              }
              }  
     } 


In case, You want to enable/disable the version for a particular list/library: say tasks list

 $ListTitle="Tasks"
 if($SPlist.Title -eq $ListTitle)
  {
   # To Enable Versioning
   $SPlist.EnableVersioning = $true
   $SPlist.Update()
  }

Ok, What about cleaning the Old versions?

I have set-upped versioning limits, Will it delete the older version beyond my limit? unfortunately "NO"

Say for e.g. I've a Document in Document Library with unlimited number of versions turned ON, Where the document has 20 versions. So, If I Set the versioning limit to 5, will it delete the Older 15 versions and Keep only the last 5? NO NO NO, Until we create a new document or edit the existing document, those versioning limits will not be applicable. This new limit will not affect the existing old version. We need to Delete them explicitly.

Take a Look at this task list, where I've limited the versions NOW to 3, But it has existing older versions!
Limit Cleanup SharePoint Versioning

Programmatically delete old versions with PowerShell
So, To clean up the existing versions, Lets seek help from PowerShell again! Let the PowerShell delete older versions.
$SPweb = Get-SPWeb "http://SharePointSite.com"
$versionsToKeep =5;
$SPlist = $SPweb.Lists["Tasks"]
 foreach ($SPitem in $SPlist.Items)
 {
   $currentVersionsCount= $SPItem.Versions.count

     if($currentVersionsCount -gt $versionstoKeep)
 {
 for($i=$currentVersionsCount-1; $i -gt $versionstoKeep; $i--)
  {
   $SPItem.versions[$i].delete()
  }
 }
 }

Alternatively, You can perform an empty update in list items to apply new versioning limit and cleanup older versions.
$SPweb = Get-SPWeb "http://sp10test.brightpoint.com"
$versionsToKeep =3;
$SPlist = $SPweb.Lists["Tasks"]

 foreach ($SPListItem in $SPlist.Items)
 {
   $currentVersionsCount= $SPListItem.Versions.count

   if($currentVersionsCount -gt $versionstoKeep)
     {
        $SPListItem.SystemUpdate()
     }
 }

When you have large number of versions in SharePoint list, iterating through versions may result in performance hits. So, the alternate method goes below:
#Variables for Processing
$WebURL = "http://sharepoint.crescent.com/operations/imphilippineswksp/QII/"
$ListName ="Project Cost"
$ItemID="512"

#Get the Web and List objects
$web = Get-SPWeb($WebURL)
$list = $web.Lists[$ListName]

#Set list version setting
$list.MajorVersionLimit = 10
$list.Update() 

#Get the List Item
$item = $list.GetItemById($itemId)
 
#Perform a empty update - without creating new version, so that versioning changes will take effect
$item.SystemUpdate($false) 

write-host "Total Number of versions Now:"$Item.Versions.count
 
#Dispose 
$web.dispose();

Update: I've created an utility to limit and cleanup old versions of documents. You can download it here:
SharePoint Versioning Manager - Control Versioning Settings & Clean Up Old Versions


You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Friday, January 14, 2011

E-Mail a Link issue in SharePoint 2007

When I use the "Send to >> E-Mail a Link" in SharePoint 2007, it gave me the wrong link!!!
E-Mail a Link issue in SharePoint 2007
It created a link like this one: http://mysite%2Ecom/test/agenda.doc

But it should be: http://mysite.com/test/agenda.doc.

Notice how the server name is URL encoded too. The %2E's should be periods.

To fix this: we need to edit the core.js file located at C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033 (Make a backup copy of this file before you make changes)

Find this line:
fileUrl=escapeProperly(httpRootWithSlash.substr(0, slashLoc))+currentItemUrl;

and replace it with this:
fileUrl=httpRootWithSlash.substr(0, slashLoc)+currentItemUrl;

we need to do the same on all the SharePoint WFE and Application servers. once done we will need to do IISRESET on all the above servers.
 
Microsoft KB solves this issue : http://support.microsoft.com/kb/938241

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Thursday, January 13, 2011

SharePoint Solutions - Building & Deployment Best Practices

SharePoint solution best practices: Based on my experience here are the best practices w.r.t solutions management in SharePoint.

1. Every customization must be Feature based solution. Doesn't matter if it’s a Webpart/Event Handler/InfoPath/Content Types or file system change. You can group the features together as solutions. Solution should have event handlers for "Feature activating" and "Feature Deactivated" events wherever applicable. Place the appropriate code in respective blocks. It’s a best practice to have un-installation module in place.

2. Be Descriptive: Ensure that all the features has a appropriate name, description, updated version number, optionally icons.

3. Follow the Four part naming or at-least Three part naming in Name Spaces, Solution names, and in the Target location of the solutions. Don’t just place them inside features folder, But create a four/three part naming folder for each feature and place the supported files inside. 
 for e.g., rather "statusreport", It would be more meaningful, if it is: Company.Sales.StatusReport.WebPart, Isn't it? This will avoid conflicts and provides better manageability.

4. Follow coding standards. Each and every Solution must be thoroughly evaluated line-by-line and tested in DEV, TEST and then moved to PROD environments. We will do the code review before moving to DEV even. Follow the coding standards(even in variable naming! Preferably PascalCase/camelCase) 

5. Avoid debugging solution in PROD environment. You can write your code in such a way, Errors are getting logged in to the Event Log / Custom Log file. Fix them in DEV at least. So that it would be easier for de-bugging.

6. We must not deploy debug mode assemblies in PROD - Remove all your Break-Points, and debug codes before packing for PROD. Make sure your code and packages are compiled in release mode.

7. Avoid any manual changes. All changes must be automated. Even a web.config changes should be scripted. Adding Configurable Properties to a SharePoint Web Part’s Tool Pane is preferable.

8. Pay more attention to the Documentation!!!. Pretend like you are giving instructions to the Person who doesn’t know anything about the particular solution.
we need guides which should contain
  • Solution abstract, flow, name and version number.
  • Activities, configurations, packages, etc. that should be installed or performed before/after the package installation.
  • Deployment steps: Detailed steps to deploy or retract the package.
  • Unit Test: How to validate that the package is deployed successfully.
  • provide the exact steps. 

9. Never deploy SharePoint DLLs along with your WSP!!! –  what’s the consequences – You will damage SharePoint. How? Your different versions DLL’s from Development box will cause In-compatible operations with PROD SharePoint environment.

10. Never Modify SharePoint’s files in File system. If you must modify have a backup and make the change as solution.  E.g. Changing the Core.CSS file for branding.. If you Change the file, It may be overwritten when applying service pack. Never Modify SharePoint Databases!

11. Use WSP Builder Project Template, Use Visual Studio 2008  – No Manual DDF files generation! Use Relative Links Whenever Possible.

12.  Maintain versions along with change history in solutions.  The assembly version number should be as the solution version number and should be incremented (format V#.#.#).  So that we can do upgrade solution, which is faster than going through the complete cycle, it does only upgrade existing features.

13. Use version control system, Like SVN, CVS, TFS and keep all the related artifacts there.

14. Double check your Object disposals. use http://code.msdn.microsoft.com/SPDisposeCheck

15. Don't hard code the parameters in the code, But make them configurable properties.

16. Handle the exceptions properly. Use Try{} Catch{} Finally{} Blocks.

17. Use SPQuery instead of SPList.items when retrieving from Large lists/libraries.

18. Last but not least: Provide excessive comments, Summary in code wherever applicable  E.g. Use summary on functions like this:
       ///  <summary>
       ///  Function's Summary
       ///  </summary>
       ///  <param Name="param1">
       ///  Why we need param1?
       ///  </param>
       ///  <returns>
      /// What we get from the function
       ///</returns>


Check out my Presentation:
Best practices for share point solution deployment
View more presentations from salaudeen.

10 best practices for building SharePoint solutions from MSDN


You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Saturday, January 8, 2011

SharePoint vs Network File Share - Which is best?

Often, I get questions from end users on deciding which one would serve best: Network File share or SharePoint? My Answer to them:

Definitely SharePoint offers much more collaborative features compared with Network File Shares. Such as:
  • Versioning Control - adds the ability to see older versions of documents
  • Meta Data (like When & who updated the documents and the ability to add and manage additional file properties, columns, metadata)
  • User security management / permissions/ Item visibility - Users do not have the ability to see information that they do not have permission to see.
  • Views (or Filters)
  • If its a Published site, You can access it from anywhere
  • Check-in / Check-out
  • Workflows - such as approval procedure, help automating simple or complex tasks
  • Recycle bins
  • Encryption  - When SharePoint sites are SSL Enabled
  • Search, Alerts, RSS, etc.

Taking all the above information in consideration, I would recommend data to be placed in SharePoint when it needs some or more of the properties mentioned above.

However, when it comes to SharePoint document libraries,  it has some of the Limitations, Like:  Files must be Below 100 MB  (There is will be a Speed difference between uploading large to a SharePoint site and uploading to a network drive. Definitely Network drive would be the faster one. Also Network File shares has the its own advantages, like: easy to Navigate, move stuff around, copy it, rename it).

Network file shares are the best option when it comes to  Large file size, Archival and  for content which Do not change much. I can mention Collaboration of teams with documents, spreadsheets presentations and Reports that would benefit from the SharePoint features.


You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Friday, January 7, 2011

Change SharePoint 2010 User Interface to MOSS 2007 Look and Feel

Yes, Its possible to provide MOSS 2007 User interface to the SharePoint 2010. There are two ways:
  1. If you have upgraded from MOSS 2007 to SharePoint 2010 using In-Place upgrade, then you will be able to do it by GUI. Here is where: Site Actions >> Site Settings >> site collection administration >> Visual Upgrade
  2. You can do the same with PowerShell. Of course if you have new installation or DB attach method used, you can do this ONLY with PowerShell.
  3.    $web = Get-SPWeb <sharepoint-url>
       $web.UIVersion = 3  //set it to 4 if you want SharePoint 2010 look and feel
       $web.Update()
So here is the result, With UIVersion 3:

With UIVersion 4:


You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Tuesday, January 4, 2011

Cascading Drop down In SharePoint Lists using jQuery

Out-of-the-box SharePoint doesn't provide a way to cascade drop downs in list forms. Luckily, jQuery provides a way to implement cascading drop downs in SharePoint list forms. Here is the step by step implementation guide:

We need to have two more lists to implement this. Lets say:

List 1: Parent list, say: Country
cascading drop down sharepoint

List 2: Child list, say: Cities
cascading dropdown sharepoint list

List 3: Our target list, where we are going to implement the Cascading drop down.

So, Now:

1. Download the jquery-1.3.2.min.js by Jquery.com, from the below link
 http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.3.2.min.js

2. Download spservices (jquery.SPServices-0.5.6.min.js) from the codeplex link
http://spservices.codeplex.com/

3. After downloading upload these two files in a document library

4. In SharePoint Designer, create your own NewForm.aspx (and EditForm.aspx)

Insert the following code: Just below
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<script language="javascript" type="text/javascript" src="/address to document library/jquery-1.3.2.min.js"></script>
<script language="javascript" type="text/javascript" src="/address to document library/jquery.SPServices-0.4.8.min.js"></script>
<script language="javascript" type="text/javascript">
 $(document).ready(function() {
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "Cities",
   relationshipListParentColumn: "Country",
   relationshipListChildColumn: "Title",
   parentColumn: "Country",
   childColumn: "City",
   debug: true
  });
 });
</script>

Here:
  • relationshipList: “Cities” : this is the name of the relationsship list = the list containing parent and child
  • relationshipListParentColumn: “Country” : Column name from the Cities list
  • relationshipListChildColumn: “Title” : Column name from the Cities list
  • parentColumn: “Country”: Column name from the list where the drop down is = Vacation Plans
  • childColumn: “City”: Column name from the list where the drop down is = Vacation Plans

Demo: http://www.sympraxisconsulting.com/Demos/Demo%20Pages/CascadingDropdowns.aspx

Cascading drop down example- What you will get as output is:
Cascading Drop down in SharePoint List Forms using jQuery
Verified that, cascading dropdown list method works on both SharePoint 2007 and SharePoint 2010

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


You might also like:

Related Posts Plugin for WordPress, Blogger...