LinkedIn

Thursday, June 27, 2013

Sharepoint : Open PDF documents in browser

You can  set "Browser File Handling" property to "Permissive" for a web application in the "General settings" page in SharePoint 2010 Central Administration.


Monday, June 17, 2013

Dynamically creating quick launch header & link in Sharepoint

The following code can be used to create a header in Sharepoint quick launch programmatically. It also adds a new link to the quick launch

 string link = System.Configuration.ConfigurationSettings.AppSettings["link"];

string HeaderlinkTitle = System.Configuration.ConfigurationSettings.AppSettings["HeaderLinkTitle"];
string SublinkTitle = System.Configuration.ConfigurationSettings.AppSettings["SubLinkTitle"];
string SitecollectionURL = System.Configuration.ConfigurationSettings.AppSettings["SitecollectionURL"];

using (SPSite site = new SPSite(SitecollectionURL))

{

SPWeb web = site.OpenWeb();
foreach (SPWeb subweb in site.AllWebs)
{

SPNavigationNodeCollection quickLaunchNodes = subweb.Navigation.QuickLaunch;
bool LinkisThere = false;
for (int i = 0; i <= quickLaunchNodes.Count-1; i++)

{
if (quickLaunchNodes[i].Title == HeaderlinkTitle)
{
LinkisThere = true;
int InitialChildrenCount = quickLaunchNodes[i].Children.Count;
bool ChildrenLinkisThere = false;
for (int j = 0; j < InitialChildrenCount; j++)
{
if (quickLaunchNodes[i].Children[j].Title == SublinkTitle)

{

ChildrenLinkisThere = true;

quickLaunchNodes[i].Children[j].Delete();

SPNavigationNode subMenuItem = new SPNavigationNode(SublinkTitle, link, true);

quickLaunchNodes[i].Children.AddAsFirst(subMenuItem);

break;

}

}

if (InitialChildrenCount == 0

ChildrenLinkisThere == false)

{

SPNavigationNode subMenuItem = new SPNavigationNode(SublinkTitle, link, true);

quickLaunchNodes[i].Children.AddAsFirst(subMenuItem);

}

break;

}

}

if (LinkisThere == false)

{

SPNavigationNode menuItem = new SPNavigationNode(HeaderlinkTitle, link, true);

quickLaunchNodes.AddAsLast(menuItem);

SPNavigationNode subMenuItem = new SPNavigationNode(SublinkTitle, link, true);

quickLaunchNodes[quickLaunchNodes.Count-1].Children.AddAsFirst(subMenuItem);

}

}

Console.WriteLine("Successfull");
Console.Read();

************************************************************************

APP.Config










Error message: “An error has occurred on the server” while working with a Wiki Library

When i navigate to the "Site Pages" library (Go to Site Actions => Site Settings => View All Site Content) in the team site, I was getting this error in the Recently Modified section.This is because there was no indexed columns in the library ( Go to Site Pgaes=> Library Settings => Indexed Columns). In my case the culprit was Wike Page Library.In the List settings, click on "Create a new index". Select "Modified" from the Primary Column drop down. Click on Create to create an indexed column. Now go back to the page where you were seeing the error, now the error should be gone.

For futher details refer the below link:
http://kirkbarrett.wordpress.com/2011/07/04/ambiguous-error-message-an-error-has-occurred-on-the-server-working-with-a-wiki-definition/