Thursday, March 14, 2013

Deploy SharePoint solutions at web application level

SharePoint solution packages by default get installed to "Globally" scope when you don't have any resources which are web application scoped. It is not a logical decision to deploy in web application scope when I have Assemblies to GAC, Application pages to Layouts folder etc. If there are any resources which are targeted at web application scope like deploying assemblies at Application bin directory, safe control entry etc then the solution deployment will force us to deploy at web application level.

Some times you will have assemblies to GAC, not a web part project and don't have any resources which are scoped against web application. At this juncture, you may need to deploy the solution at web application scope for various reasons like

  • Security  - To hide features part of the solution from showing off in other web applications.
  • Shared Environment - Other applications running in the Farm and they don't to get impacted of your WSP
  • Isolation - Having a global scoped WSP will recycle all app pools during deployment
This can be achieved by adding a safe control entry to the solution package and solution deployment script will be satisfied by this. If it is MOSS 2007 then its matter of Manifest.xml modification. But SharePoint 2010 is powered with Visual Studio 2010 tools for SharePoint, if we make any modification to Manifest.xml then the Package designer will ignore its support to the developer.

The solution would be, open your package designer, scroll down and find the Advanced Tab, click on "Add" button to add additional assemblies.



Select "Add assembly from project output", input the namespace and full assembly name for the safe controls.

Save these settings and hit on Ok button,one more setting to update. Click on the project in solution explorer and press F4 to open the properties window, exclude the assembly from being copied to solution package.Because we already added the assembly in "Additional Assembly" section.


Package and deploy the solution at web application level scope.

Thursday, February 14, 2013

Portable mail server on desktop for SharePoint

I used to run an SMTP server which comes along with IIS 6.0 whenever I need to test an outgoing emails from a custom SharePoint solution. After a long time I hate running a server process just to receive a bunch of emails relayed within my development machine and also due to compliance, network administrators may block the SMTP server in a desktop.

Here comes a nifty tool from Codeplex called Papercut for all our problems. Ok, how to resolve the SMTP puzzle ?


  1. Download Papercut from CodePlex, unzip the zip package (Note: there is no msi package or a setup.exe, so you are not violating software compliance too) and keep it in a handy location
  2. Find your machine IP first by using ipconfig and make a note.
  3. Map your IP to SharePoint’s outgoing mail settings in SharePoint Central Administration console.



Open PaperCut.exe -> click on “Options” -> Map your machine IP here. Keep it open and running, do not close.


Now test all your email functionalities and you should be seeing all emails in the left pane with time stamp.

Watch all your mails are being forwarded to Papercut.exe.


Wednesday, January 30, 2013

SharePoint User Profile Service - method not found exception

While trying to access user profile service application in few machines, there came this exception


Method not found: 'Microsoft.SharePoint.Administration.SPIdentifierType Microsoft.SharePoint.Administration.SPAce`1.get_BinaryIdType()'

we were unable resolve by re provisioning the service application, restarting the timer jobs and restarting the servers. As this exception arises from a SharePoint assembly, looked at the version of the server and found it is SharePoint 2010 RTM version.

It requires following updates to resolve the issue


Don't forget to run the PSConfig wizard after installing Service pack and cumulative updates.

Re-provision the User profile service application and proceed.

Tuesday, October 30, 2012

Shredded Storage in SharePoint 2013

How many times we thought through before enabling versions for a specific document library which will handle files of huge size during the capacity planning exercise in MOSS 2007 and SharePoint 2010.

After enabling versions in a document library, imagine there is a DSTD.docx of 20 MB word document of v1.0 in that document library and user is attempting to edit this document. SharePoint 2010 server will serve the full document to the MS Office Word Client. After making changes to couple of page, when the user hit the Save/Sync button, SP 2010 gets the full 20 MB modified document and stores it as a seperate entry in content database.

Say if we run across ten major versions of this specific document in SP 2010, the disk space occupied by this document in Sql Server content database would be 20MB * 10 versions= 200 MB

SP2013 changes this scene by using the Shredded storage technique, if you were a DB admin or an IT Pro the you should have heard about Differential backups or incremental backups. Shredded storage is similar to this.

In SP2013,   when the user hit the Save/Sync button after making changes in DSTD.docx v1.0 , SP 2013 gets the delta changes in that modified document and add an entry in content database.

So in SP 2013 enabling the versions is not gonna eatup disk storage, reduces disk I/O as only the delta is getting stored and efficient use of network bandwidth.

Monday, July 16, 2012

No results in SharePoint Search but it exists in index

SharePoint Search crawler succeeds crawling the content and the same is available in crawl log. There is no crawl log error, content is a plain MS Word document, Web Application is properly associated with Search Service application but unable to see not even a single search result.

This was bit embarrassing and to nail down this issue, I was trying look in to Windows Event logs and SharePoint ULS logs, but there is no interesting message there for me to troubleshoot.

Removed the SSA association and deleted the SSA. Created a new SSA and did the association again. But the result is "none"

Verified that the Search service account has read permission in the web application and in the database as well. They exists perfectly but i don't not even a single search result.

Finally enabled the "Verbose" mode ULS logging and tried to filter using "Query Processor" category. There was new things started appearing in verbose mode

AuthzInitializeContextFromSid failed with 1355. The querying user's Active Directory object may be corrupted, invalid or inaccessible. Query results which require non-Claims Windows authorization will not be returned to this querying user.

Not sure why this exception occurs under "Unexpected" category but the recently I've configured a local admin account as service account through Power shell scripts. Probably this might be the culprit.

After hours of re-search found an MS KB article, which explained the same symptoms and cause.

Open up your SharePoint 2010 Management Shell console as an administrator and run the following PS script.

$searchApp = Get-SPEnterpriseSearchServiceApplication "SSA Name"
$searchApp.SetProperty("ForceClaimACLs",1)
Do a full crawl on all content sources to get the search results. Don't forget to switch off the verbose mode ULS Logger.

Wednesday, July 4, 2012

Render a spreadsheet as HTML with Excel REST services

                             An interesting question from one of my peer, whether we can show excel spreadsheet using REST services and they don't want all the features of Excel Web access web part. Just show the spreadsheet on a web page.

                            This question drove me to take a look at the capabilities of Excel services. IMHO Excel services were made for calculation and resource-heavy number crunching jobs along with a Excel web access web part which is used to render the sheets. But after looking at the REST API(yes it's beautiful), it totally revamped my thinking about this service.

First things first

  1. You need an SharePoint 2010 Enterprise Sever and Excel services should be configured properly in that
  2. Make sure you see ExcelRest.aspx under \14\ISAPI.

How to use this ExcelRest.aspx ?

       Say you have an Excel file stored in a document library path like below

http://Foo/Site/Shared Documents/Employee.xlsx
then the URL will be
http://Foo/Site/_vti_bin/ExcelRest.aspx/Shared Documents/Employee.xlsx

           If you are like me and worked a lot with asmx web services and hitting just the endpoint http://Foo/Site/_vti_bin/ExcelResta.aspx you will get HTTP 400 error because it's simple, REST is representational and nothing is represented here, its just an endpoint.

How to show as HTML and what are the other options ?


  1. /_vti_bin/ExcelRest.aspx/Shared Documents/Employee.xlsx/Model - Find more subsects(Ranges,Charts,Tables, PivotTables) of what you are going to query.
  2. /_vti_bin/ExcelRest.aspx/Shared Documents/Employee .xlsx/Model/Ranges('Sheet1!A1|H15')?$format=html - From sheet 1, Fetch the data specified in the range and render in HTML.
  3. /_vti_bin/ExcelRest.aspx/Shared Documents/Employee.xlsx/Model/Charts(‘RevenueChart’)?$format=image - Fetch the chart and render it as a PNG image

What are the formats available for me to render ?


  1. ?$format=html  - Renders as plain HTML fragment, for tables,sheets and pivot tables
  2. ?$format=atom  - provides you a ATOM feed
  3. ?$format=image - Renders an PNG image, only supported for Chart outputs
  4. ?$format=workbook - Downloads the whole workbook.
Although there are some unsupported features, given the abilities of OOTB Excel services luxuries like load balancing the requests,caching etc it is worthwhile in a scalable solution.

Want to learn more, refer MSDN

Monday, May 14, 2012

Prevent your mails from being forwarded or replied

I always amazed at the rights management plugin with IRM services provided by Microsoft which restricts me from forwarding/replying a protected mail. But what is the case of small companies who dont have these IRM luxury on their infrastructure.

There is a niche solution provided by Microsoft but still that is a Micrsoft Research project. A Outlook plugin called "NoReplyAll", a light weight plugin installs right in to outlook 2007/2010. It adds up additional buttons on the ribbon like below


So whenever I send an email, I need to choose from the above option to make my mail secure. The end user who is receiving the mails don't need this plugin in their outlook. This plugin makes use of flag settings in Exchange and outlook, so if the recipient is not using any one of these then the flags are not honoured.

This cool plugin mandates the following 
  • Outlook should be the mail client on sender and recipient's machine
  • Both users should be in the same domain using Exchange

If you want robust and rigid security then this plugin is not your choice, you should head for IRM.

Now you gotta plugin which will avoid accidental and unnecessary "reply alls", Download/Deploy it in your Outlook and enjoy.

It is a research project not an RTM product, so beware.