Folder custom content type limitations

Recently faced the problem with custom content type folder.

When add publishing controls to you custom content type these fields are not saved and folder is not crated. Apperantly this behaviour is already spotted in SharePoint 2007 and was never fixed (for some good reasons I suppose).

So the solution we used was to inherite not from folder base type (0x120) but from document set content type with id “0x0120D520“.

In this way all publishing fields are possible to include in your custom content type;

Hope this helps,

Andrew Adamich

Advertisements

Add custom link to structural navigation menu

Recently I had to add custom link to structural navigation menu in SharePoint 2013. After searching on over the net I found noting and tried to check what properties should be set inside navigation provider by craeting manually link in SharePoint navigation and checking result with debugger…

Here are properties that should be set to be able to insert custom link node in global navigation provider:

ndParent.Properties["NodeType"] = "AuthoredLinkPlain";
ndParent.Properties["vti_navsequencechild"] = true;

  • NodeType property indicates that the node is a custom link.
  • vti_navsequencechild property makes link to appear inside the navigation provider

Here is a full peace of code to add link:

private void SaveNavigationNode(string title, string url)
{
if (string.IsNullOrEmpty(title)) return;
if (string.IsNullOrEmpty(url)) return;

var web = SPContext.Current.Web;

web.AllowUnsafeUpdates = true;

// Get the top link bar.
var topnav = web.Navigation.TopNavigationBar;

var existingNode = topnav.Cast().FirstOrDefault(n => n.Title.ToLowerInvariant().Equals(title.ToLowerInvariant()) ||
n.Url.ToLowerInvariant().Equals(url.ToLowerInvariant()));

if (existingNode == null)
{
var ndParent = topnav.AddAsFirst(new SPNavigationNode(title, url, true)); // Add to collection.
ndParent.Properties["NodeType"] = "AuthoredLinkPlain";
ndParent.Properties["vti_navsequencechild"] = true;
ndParent.Update();
}
else
{
existingNode.Title = title;
existingNode.Url = url;
existingNode.Update();
}

web.AllowUnsafeUpdates = false;
}

Hope this helps,

Andrew Adamich

how to apply custom master page to application pages

Great and working article about how to put custom master page within application page. In my case this was custom display form for content type…

Thanks a lot for share this peace of code!

Rana Omer Hussain's RegEdit

I came across a position, where i have an application page developed for user requirement and the user desires the look and feel of this page to me similar to other pages in the context.

I tried so many alternatives but didn’t get prospered; I found the right to use the default.master or custom master page for application pages.

First thing is that if you need to use a masterpage from the site context, you want to have the similar content placeholders as are expected by the master page.

Master pages can be loaded dynamically. This can be done by assigning a master page file to the MasterPageFile property in the Page object. This property may only be assigned in the Page PreInit event, this is the first event executed page execution lifecycle.

Copy and paste this below code in your custom application page and deploy the assembly to GAC…

View original post 73 more words