Wednesday, December 4, 2013

Code Access security

Create Public Key Blob for an Assembly

Metadata navigation is not supported for content type column

Search index has issues with Draft item security setting in a document library

Indexing list columns is necessary for large lists

Thursday, November 28, 2013

Some very useful powershell commands

Mobile carousel image viewer



I have used the html script from below blog for mobile carousel control, this is a great control, thanks to Matteo Spinelli who has done a great job providing such a useful control in as little code as possible. It users css styles for image transitions which is very efficient in browser.
HOW TO

DEMO

It was requirement of the project to use this control for horizontal swapping, which unfortunately seems to be having few issues, therefore I have modified the cardview.js file to work a little smoother in horizontal swapping mode. The complete code can be found here.

SharePoint 2010 uncustomize a page layout

 To uncustomize a page layout or master page,

2) Using powershell script: http://admin-sharepoint.blogspot.co.uk/2013/05/unghosting-customized-page-layouts-with.html

3) Using SharePoint Designer: http://mosshowto.blogspot.co.uk/2008/10/re-ghost-master-pages-sharepoint.html

4) Using stsadm: http://blog.ithinksharepoint.com/2011/05/10/issue-with-updating-sharepoint-publishing-page-layouts-and-ghosting/

5) Using site settings, though this works for a normal site page, I am not sure if will works for a page layout or a master page: http://rolandoldengarm.wordpress.com/2012/01/23/page-layouts-in-master-page-gallery-not-updated-after-a-deployment/  

6) Free utility: http://www.codeproject.com/Articles/514279/Ghostplusun-ghostedplusSharePointplus2010plusfiles

To disable customization
http://blogs.msdn.com/b/steve_fox/archive/2010/03/08/ghosting-unghosting-in-sharepoint-2010.aspx

other references:
https://www.google.co.uk/search?q=sharepoint+2010+customize+page+layout&oq=sharepoint+2010+uncustomize+p&aqs=chrome.1.69i57j0l5.20326j0j8&sourceid=chrome&espv=210&es_sm=93&ie=UTF-8#es_sm=93&espv=210&q=sharepoint+2010+unghost+page+layout&start=10

Wednesday, November 27, 2013

SharePoint 2010 page layouts versioning

A page layout deployed through visual studio feature automatically updates the underlying page layout file everytime a new deployment is done, however

  1. This change is not reflected in version history, thus there is no way to figure out by just looking at the master pages gallery when was the page layout modified last time. The only way this can be verified is by opening the feature folder under 14 hive and making a note of the last modified date for the page layout file.
  2. The page layout does allow us to manually upload a new version, but EnableSessionState attribute is not allowed in manually uploaded page
  3. If a custom class derived from a PublishingLayoutPage class is used as base class for the page layout then manually uploaded page layout requires it to be registered as a safe control, even though the same template deployed through a feature does not.

Tuesday, October 15, 2013

Sharepoint 2013 Custom Image reditions

While going through this article I found a link to and article on custom image renditions in SharePoint 2013, its certainly useful.

http://blog.mastykarz.nl/responsive-image-renditions-sharepoint-2013/

Windows process explorer

This comes in handy if we need to find out a dlls is being used by which processes. I had to use it when I got an error "cannot access assembly because it is being used by another process" while uninstalling a dll from GAC.

http://social.msdn.microsoft.com/Forums/sharepoint/en-US/356913a7-dda7-41a7-8702-f71ec0a8b7db/cannot-add-assembly-to-gac?forum=sharepointdevelopmentlegacy

The reason for  "cannot access assembly because it is being used by another process" error was that I has added a reference to this dll in a Visual Studio 2012 project and the project was open. The issue was resolved after I close all instances of visual studio

Wednesday, October 9, 2013

Mobile image viewer

SharePoint custom summary links field with rich HTML

http://blog.zebsadiq.com/post/How-to-allow-rich-text-editing-on-summary-link-description-field.aspx
http://msdn.microsoft.com/en-us/library/aa981226%28v=office.12%29.aspx
http://webarj.wordpress.com/2007/05/07/templating-field-controls-in-moss-page-layouts/

http://msdn.microsoft.com/en-us/library/bb861799%28v=office.14%29.aspx

While following steps in the above post I was unable to add using directive for System.Windows.Controls namespace found in PresentationFramework.dll, after searching a little on internet I realized that the dll reference can not be added since I was trying to use 32 bit dll version found in Program Files (x86) directory. Instead when I added dll reference to Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll, the namespace was available.

The sharepoint software factory also has precipices to add custom fields although not one for custom summary links field
http://spsf.codeplex.com/

after installing it I was getting an error "The package SPAM.SPSF could not be activated, the template cannot be unfolded", the reason was I did not activate the SPSF extention as explained here
http://msdn.microsoft.com/en-us/library/ff697223.aspx

Field Definitions
http://msdn.microsoft.com/en-us/library/aa979575.aspx

Finally I used below steps to create a simple field which only saves URL to a custom list
http://bernado-nguyen-hoan.com/2011/11/07/walkthrough-custom-field-type-for-uploading-and-displaying-images-in-sharepoint-2010-lists/

And then added that lists default view webpart to the "View Rendering Template" and "Diplay Rendering Template". The steps to create a list view webpart programmatically are explained in below post,

http://stackoverflow.com/questions/1588019/programmatically-insert-a-list-as-a-webpart-in-a-webpart-page-in-wss-3-0


However I did not use any webpart zone in my control and simply added the webpart to the base.TemplateContainer.Controls collection.

http://msdn.microsoft.com/en-us/library/office/ms543215(v=office.14).aspx

Tuesday, October 1, 2013

Deleting orphaned content type

If deleting an orphaned content type gives the error "SPException: The content type "XYZ" is part of an application feature.", we need to change "IsFromFeature" flag in content database for the particular content type from "1" to "0" as explained in these posts:

http://sharepoint.stackexchange.com/questions/11114/how-to-delete-a-content-type-part-of-an-application-feature

http://apichot.blogspot.co.uk/2009/11/how-to-delete-orphan-content-type.html?_sm_au_=iVVW6SjD4nF5Jrt6

and then  delete the content type either manually or using code as explained here:

http://msdn.microsoft.com/en-us/library/ms453791.aspx

If you get an error "Content Type is still in use<nativehr>0x800710d3</nativehr><nativestack></nativestack>" follow below instructions
http://www.mysharepointadventures.com/2011/06/content-type-is-still-in-use-woes/

There are some times broken link as explained in below post, but this method is too risky to try and not supported by microsoft. I have just mentioned it here for a reference, but I would not recommend it.
http://mqsharepoint.blogspot.co.uk/2009/01/content-type-is-still-in-use.html?_sm_au_=iVVtTJsssQkjV8tM 

Thursday, August 15, 2013

Custom breadcrumb control

Channels in SP 2013

Remove tables from webpart zones

Measure performance using SPMonitoredScope

Friday, August 9, 2013

SharePoint get names of all lists in a site

CAML Query builder

Search contents in a sharepoint site

There are several ways to fetch data from sharepoint 2010. Below are few of the most standard ones, however it is worth mentioning that the list does not include client object model or web services which are equally important aspects.

These methods can be used for:
  1. Execute search queries
  2. Get enumeration of list items, documents, lists, pages, etc.
  3. Get navigation structure either with hidden objects included or without them
  4. Iterate through all contents in SharePoint 2010 site
Overview
http://www.codeproject.com/Articles/638734/Basics-of-Sharepoint-Search

Using search API
http://social.technet.microsoft.com/wiki/contents/articles/18202.using-the-keywordquery-class-to-search-sharepoint-content.aspx
http://msdn.microsoft.com/en-us/library/ms544561%28office.12%29.aspx
http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/02/19/how-to-use-the-moss-enterprise-search-keywordquery-class.aspx

Using site data query
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsitedataquery.webs.aspx
http://www.pointsharepoint.com/2008/08/spsitedataquery-crosslistqueryinfo.html
        --- from a single list
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/f54cdcd1-d2a3-470e-a939-835934e801c4/using-spsitedataquery-to-pull-items-form-specific-lists

Using CrossListQueryCache
http://donahoo-development.com/index.php/2010/04/16/crosslistqueryinfo-and-crosslistquerycache/
 http://bloggingabout.net/blogs/bas/archive/2009/03/27/using-the-crosslistqueryinfo-and-crosslistquerycache.aspx
http://sharepoint.nailhead.net/2008/04/musing-on-crosslistquerycache-class.html
http://donahoo-development.com/index.php/2010/04/16/crosslistqueryinfo-and-crosslistquerycache/

Using ContentByQueryWebPart and CrossListQueryInfo and CrossListQueryCach
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.publishing.crosslistquerycache.aspx

SharePoint query classes
http://purunep.wordpress.com/2012/04/26/sharepoint-query-classes-and-where-to-use-them/
http://extreme-sharepoint.com/2012/07/17/data-access-via-caml-queries/

SharePoint 2013
http://code.msdn.microsoft.com/office/Query-Search-with-the-372139b5

SPChangeQuery
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spchangequery.aspx


Wednesday, August 7, 2013

Create content types in VS

http://msdn.microsoft.com/en-us/library/gg295290%28v=office.14%29.aspx
http://msdn.microsoft.com/en-us/library/ff648024.aspx
http://leedale.wordpress.com/2009/01/20/creating-an-enhanced-rich-text-field-in-your-sharepoint-content-types/
http://stackoverflow.com/questions/2172714/deploying-content-type-with-publishing-html-field-by-feature-saving-content-not
http://sharepoint-ss.blogspot.co.uk/?_sm_au_=iVVWSNbsjQF5kPbs
http://harishnagalapur.wordpress.com/

Add-in to create page layout from custom content type
http://visualstudiogallery.msdn.microsoft.com/990bd0c8-a55b-4643-a35d-88136594c3d9/

referenced here
 http://rburgundy.wordpress.com/2010/05/21/sharepoint-2010-create-page-layout-based-on-a-custom-content-type-in-visual-studio-2010/

First four characters of the field name must be alphabets
http://www.dannyhansen.nl/sharepoint/sharepoint-2010/first-character-sharepoint-2010-internal-field-name-replaced-with-its-hexadecimal-code

Creating content types programetically
http://sharepointdragons.com/2012/04/10/content-type-galore/

Script to change multiline textbox mode
http://chweber.wordpress.com/tag/sharepoint-2010/

SharePoint OOTB field types
http://sharpointpractice.blogspot.co.uk/2011/08/sharepoint-field-types-elementsxml.html?_sm_au_=iVVpRKFRLF7qMSnQ

Fieldref element in the content type
http://msdn.microsoft.com/en-us/library/aa543225.aspx

Jquery Image animations

Monday, August 5, 2013

Apply CSS only to IE

To apply css file only for IE use this tag

<%-- Added a version number to force refresh --%>

<!--[if lt IE 9]>
        <link rel="stylesheet" type="text/css" media="screen" href="/_layouts/Myfeature/css/MyIEStyles.css?v=5" />
<![endif]-->


Secure micro services using jwt and ocelot

  Secure Microservices Using JWT With Ocelot in .NET Core (code-maze.com)