Saturday, November 17, 2012

"File Not Found" error in SharePoint 2010

You open your SharePoint site page and see "File Not Found". You have no clue what's went wrong.

This issue might be caused due to following actions:
1. Retracted any solution package from SharePoint site
2. Deactivated any feature.

If you have taken any of the action mentioned above then you needn't to worry as things are under control.

Now, try to open following pages:
http://<site name : port>/_layouts/managefeatures.aspx?Scope=Site
http://<site name : port>/_layouts/viewlsts.aspx

You should be able to open above pages.

If yes (or even no :)), just re-deploy the solution or re-activate the feature and you are good to go.

What went wrong when you took any of the action mentioned above?

Your solution package or feature are responsible for deploying any custom master page, custom control or some thing which was being referenced by SharePoint site. When you retract solution package or deactivate the feature, site doesn't find those components and shows "File Not Found" error.

Even if this doesn't solve your problem, you will find lots of other solution so keep your hopes alive. All the best!


Wednesday, October 10, 2012

Administrative and Service Accounts for SharePoint Foundation 2010

Given below is a consolidated list of all accounts required for administrative deployments and services for SharePoint Foundation 2010.


Server farm-level accounts:

1. SP_SQLService (local account can be used so not required)

This account should be:
  • Either a Local System account or 
  • Domain user account
Purpose: The SQL Server service account is used to run SQL Server. SQL Server prompts for this account during SQL Server Setup. It is the service account for the following SQL Server services:
  • MSSQLSERVER
  • SQLSERVERAGENT

2. SP_Install

This account should be:
  • Domain user account.
  • Member of the Administrators group on each server on which Setup is run.
  • SQL Server login on the computer that runs SQL Server.
  • Member of the following SQL Server security roles:
    • securityadmin fixed server role
    • dbcreator fixed server role
Purpose: This is Setup user account and is used to run the following:
  • Setup on each server computer
  • SharePoint Products Configuration Wizard
      If you run Windows PowerShell cmdlets that affect a database, this account must be a member of the db_ownerfixed database role for the database.


3. SP_Farm

This account should be:
  • Domain user account.
Purpose: This is server farm account (referred as database access account) and is used to perform the following tasks:
  • Configure and manage the server farm.
  • Act as the application pool identity for the SharePoint Central Administration Web site.
  • Run the Microsoft SharePoint Foundation Workflow Timer Service.
      Additional permissions are automatically granted for the server farm account on Web servers and application servers that are joined to a server farm.
        The server farm account is automatically added as a SQL Server login on the computer that runs SQL Server. The account is added to the following SQL Server security roles:
  • dbcreator fixed server role
  • securityadmin fixed server role
  • db_owner fixed database role for all SharePoint databases in the server farm


Service application accounts


4. SP_ServiceApp
This Account: 
  • Must be a member of the Farm Administrators group.
NoteFor following service applications:
  • Business Data Connectivity Service
  • Search Service
  • Usage and Health Data Collection Service
  • Application Discovery and Load Balancer Service Application (Must be farm account)
Used as the identity for the service application endpoint application pool. Unless there are specific isolation requirements, the application pool can be used to host multiple service application endpoints.



Microsoft SharePoint Foundation 2010 Search accounts


5. SP_SearchService
This account:

  • Must be a domain user account.
  • Must not be a member of the Farm Administrators group.

Note: The following are automatically configured:
  • Access to read from the configuration database and the SharePoint_Admin content database.
  • Membership in the db_owner role for the WSS_ Search database

6. SP_ContentAccess

This account:
  • Same requirements as the SharePoint Foundation Search Service account.
  • For proper search functionality and information security, do not use an administrator account or an account that can modify content. 

Note: Automatically added to the Web application Full Read policy for the farm.
This account is automatically added to the Full Read policy, giving it read-only access to all Help content.



Additional application pool identity accounts


7. SP_WebApp

No manual configuration is necessary.
Note: The following are automatically configured:
  • Membership in the db_owner role for content databases and search databases associated with the Web application.
  • Membership in specific application pool roles for the configuration and the SharePoint_AdminContent databases.
  • Additional permissions for this account to front-end Web servers and application servers are automatically granted.



Also consider following important points:

1.) After you complete installation and configuration of accounts, ensure that you do not use the Local System account to perform administration tasks or to browse sites.

2.) A user account that is used by application pools or services must have permissions of a domain user account and must not be a member of the Farm Administrators group or a member of the Administrators group on the local computer. Using highly privileged accounts for application pools or services poses a security risk to the farm, and could allow malicious code to execute.

3.) Using built-in accounts as application pool identities or as service identities is not supported in a farm configuration. Built-in accounts include Network Service, Local Service, and Local System.

4.) The Farm Account, which is used for the SharePoint 2010 Timer service and the Central Administration site, is highly privileged and should not be used for other services on any computers in the server farm.



Technical Reference:

(1-3) Deployment administrative and service accounts

(4-7) Plan for administrative and service accounts

Monday, September 17, 2012

Internal server error exception: System.ServiceModel.ServerTooBusyException: SearchService.svc is too busy. ---> System.Net.WebException: The remote server returned an error: (503) Server Unavailable.


Problem Summary
Search stops working when multiple users try to search the SharePoint site.
(Server restart can solve the issue which should not be accepted as a solution.)

Solution
Problem itself provided two clues :
- Search stops working with multiple users (Multiple requests causes problem)
-  Server restart can solve the issue  (Some cache is being cleaned which enables search again)

Please note 503 error is returned when web server directs request to web site itself. It means there is some limit of requests which can be served by web server. These settings are defined at application pool level.

FYI, SharePoint search is handled by Search Service Application which uses an application pool for serving search requests.

Given below are the configurations which are required to resolve this issue:

1. Configure Search Service Application to use a separate application pool if application pool is being shared by other Service Applications also.  
Reason : It application pool is being shared by other service applications, doing configuration changes can have unexpected impact on other services.

2. Increase application pool's (in advance settings) Queue Length from 1000 to 10000.
Reason : Increasing this limit would minimize the chances of throwing 'Server unavailable (503)' error.

3. Enable recycling for application pool on following conditions:
  i.) When number of requests exceed 100 count
  ii.) Every day at 1:00 AM.
Reason : Exception seems to be very much related with number of search requests processed by server crossing the limit. Enabling recycle settings would overcome this.

Friday, August 31, 2012

Custom Web Part to Add document to SharePoint document library

I am categorizing this post into two parts. First part is just to make foundation for this post.

PART I:

To display files and folders of a document library in a tree view style you will need to create a custom web part and for that, you can always refer this link:
http://www.codeproject.com/Articles/37530/Document-Library-Tree-View-Web-Part-for-SharePoint














Now, let's come to the second part which is also the focus of this post.

PART II:

Now suppose, you need to add a document from above web part while refreshing the tree view at the same time.
















Given below is the code to achieve this:



Code Description:
a.) Get document library permission level for logged in user so that 'Add Document' link can be hidden for less privileged users.
b.) Put 'Add document' link on web part with SharePoint look and feel. On clicking, it calls a java script function which is registered using 'RegMyScript'.
c.) It adds document to document library in the SharePoint way and also refreshes library tree view to show the newly uploaded document.

Code Download Link.

Tuesday, August 28, 2012

Using Multiple Selection List Box control in InfoPath 2010

Multiple Selection List Box control acts like a list box which can be populated with values stored in a SharePoint list while rendering items with a check box in front of them at the same time.

Here, we will look into two capabilities of this control which are not very straight forward:

  • Retrieving all selected options with a delimiter
  • Show/Hide input details mapped with one of the item in control


Retrieving all selected options with a delimiter

Let's say, you have the requirement of getting all selected items from Multiple Selection List Box control and need to promote these to SharePoint form library.

(To promote this control value, you select 'merge' from drop down at the time of property promotion.)

Here comes the problem !

You may find promoted values unexpected as selected values are merged without any separator/delimiter. This control doesn't provide any option for putting a delimiter between merged values.

To achieve this, you need to work with expressions in InfoPath.

At the time of Submit,
- Create a rule to store provided expression (below) in any hidden control.
- Promote hidden control to SharePoint form library instead of multiple selection list control.

Syntax:
substring(eval(eval(lbControl[. != ""], 'concat(", ", .)'), ".."), 3)     // Store this into hidden control

Description:
It is using eval function of InfoPath which iterates through every item of list box control and put a prefix ", " with item if selected. lbControl is our list box control.


Show/Hide Input Details mapped with one of the item in control

Let's say, we have a requirement of making a control (text box, drop down list etc.) visible or invisible based on selection of a particular item in multiple list box control.

Put your target control in a section and create a formatting rule on section saying like this:

a.)









b.) And, if above condition is true, then hide the section.

Description:
lbRequestType -> This is your multiple selection list box control
"IT Department" -> It is an item populated in multiple selection list box control.

Launching applications from Internet Explorer browser

Solution provided here assume that application is placed on a known location on any client machine (for e.g. Notepad.exe).

I have used ActiveX with shell scripting for launching Win32 (Non Win32 can be launched too) applications.

JavaScript Code:
























Wednesday, July 25, 2012

Accessing web.config of SharePoint Web Application

Finding this information was not very easy, so decided to write this post.

References:
- Microsoft.SharePoint.Administration
- System.IO















Credit goes to KickTech blog post.


Tuesday, July 24, 2012

Microsoft Officially Announces SharePoint 2013

Wait is over !!!

Microsoft has announced the next version of SharePoint. It is SHAREPOINT 2013!

Two versions :

- SharePoint Foundation 2013 Preview
(Minimum RAM : 8GB, Processor : 64-bit, 4 cores )

- SharePoint Server 2013 Perview
(Minimum RAM : 24GB, Processor : 64-bit, 4 cores )

For details go to Hareware and Software Requirements

One good news !

SharePoint 2013 is based on Microsoft .NET Framework version 4.5 Release Candidate (RC). So this time SharePoint seems not to lag being .Net framework. :)

For more details on SharePoint 2013, visit official information here

Tuesday, June 12, 2012

"The collection has not been initialized. It has not been requested ..." in SharePoint 2010 ECMAScript Client Object Model.


This is a common error which you will see while working with ECMAScript Object Model of SharePoint 2010. There could be multiple reasons behind this issue as discussed below:

Cause 1:
Error occurs when you try to access properties of an object which has not been initialized.
Let's understand it through an example (excluding script start and end tags).

var currentUser;
var uLogin;
var uTitle;
var ctx;

function LoadUserDetails() {
//Get Context
ctx = new SP.ClientContext.get_current();

//Get logged in user
currentUser = ctx.get_web().get_currentUser();

ctx.load(currentUser);
ctx.executeQueryAsync(queryTrackerList, failure);
}

function  AccessUserDetails() {
//Get user login name
uLogin = currentUser.get_loginName();
    
//Get User title
uTitle = currentUser.get_title();
    
        alert('Current user login name : ' + uLogin);

        alert('Current user display name : ' + uTitle);


Here, I am displaying current logged user details : Login Name and Display Name.

currentUser = ctx.get_web().get_currentUser();

Above code line returns an SP.User object which is uninitialized (does not contain any property value) until a call to executeQueryAsync method.

So if we call user object properties (get_loginName and get_title) in first method ' LoadUserDetails ', it will return us an error i.e. "The collection has not been initialized. It has not been requested ...".


Solution:
Alway access object properties only after it has been initialized. As, accessing SP.User properties in second method ' AccessUserDetails' will work without any problem as executeQueryAsync method has been called so object has been initialized and contains properties values.



Cause 2:
Let's say you have more than one functionalities on the same page which are interacting with SharePoint list/s to read/update/delete items.

JS file1:


$(window).load(function(){

    ExecuteOrDelayUntilScriptLoaded(function(){func1();}, "sp.js");

});

function func1()
{
       //Doing something...
}



JS file2:


$(window).load(function(){

     ExecuteOrDelayUntilScriptLoaded(function(){func2();}, "sp.js");

});

function func2()
{
       //Doing something...
}



As you can see, on page load two different functions are executing which are calling "ExecuteOrDelayUntilScriptLoaded" function. This would also result in the same error.

Solution : 
If possible, try to do both functionalities with single JS file as given below...


$(window).load(function(){

     ExecuteOrDelayUntilScriptLoaded(function(){func1();}, "sp.js");

});

function func1()
{
       //Doing something...
       ctx.executeQueryAsync(func2, func2);  //func2 will be called on success or failure both
}



Thursday, May 24, 2012

Hide Old Events from Calendar's 'calendar view' in SharePoint

By default, SharePoint calendar provides two types of views : Calendar View and All Events View. Hidding old enteries from all events view is straight-forward. In this view, you can apply filter on 'End Time' field of calender event something like this expression:

'End Time' [Today]  -> (Please note this is only a representation)

It hides all events older than today.

BUT, achieving same thing in Calendar view is not so easy as it doesn't show 'Start Time' and 'End Time' fields in filter column. But, still it's possible !

Here's the solution !!!

Select 'Created' field as a filter column. In operator control, select 'is greater than or equal to' and in value, type [Today].
So filter expression will look like : 'Created' [Today].

Click 'Ok' to save.

Now, click 'modify view in SharePoint designer' on calendar ribbon to make changes in view using SharePoint designer..
[Calendar Tools -> Calendar -> Modify Views -> Modify View in SharePoint Designer (Advanced).]

Calendar view opens in the SharePoint designer. Search for 'Created' keyword and you will find given line:

<Geq><FieldRef Name="Created"/><Value Type="DateTime"><Today/></Value></Geq>

This is CAML query which filters calendar items in view. Replace 'Created' with 'End Time' and save.

You will see that all events older than today are hidden in Calendar view.

Please let me know if you face any issue.


Friday, May 18, 2012

Best practices for planning My Sites

When you plan and set up My Sites, you should always follow Microsoft's best practices as given below :
  1. Dedicated Web Application : You should use a dedicated web application for hosting My Site host site collection for following reasons:
    • To improve performance and manageability.
    • As enabling self-service site creation feature on a web application makes them vulnerable for cross-site scripting, it is required to isolate any scripts running in My Site from affecting other sites in your environment (see more details).
       
  2. My Site host at Web Application Root : My Site host should exist at the Web application root unless it's a requirement to create it deeper in the path.
          Note : Without this, you will get an error message saying that no site collection exists when enabling self-site creation for web application. If there is a requirement of creating My Site host deeper in the path, it must be under an explicit inclusion managed path. Additonally, you must create a site collection at the Web application root, although this site collection can be empty and created without a template.
      
  3. User's 'My Content Section' Naming Format : While setting up My Site, in the 'Site Naming Format' avoid choosing 'User name (do not resolve conflicts) option if you are not sure about the uniqueness of the user account (in multiple domains). This format is used to create a site collection for user when he/she first time clicks 'My Content' section of My Site.
       
  4. Plan for Profile Syncronization : Although configuring the User Profile service application is required for My Sites, synchronizing profiles between SharePoint Server 2010 and directory services or business applications is optional. This option is highly recommended for consistent and timely information on user's My Site.
       
  5. Configure Managed Metadata service application : The Managed Metadata service application enables Web applications to store and access keywords from a managed metadata term database.
    For My Sites, this functionality is required for users to specify keywords as their areas of expertise in the Ask Me About section and to use keywords for social tagging by using the Tags and Notes and I Like It features on the My Profile page of a My Site.
    A Managed Metadata service application is highly recommended for My Sites.  

For more details, visit this link.

Thursday, May 17, 2012

SharePoint 2010 Databases


SharePoint 2010 is a combination of range of products like foundation, standard, enterprise editions, project server, FAST search server for SharePoint 2010.

All these products have their own databases which are categorized as below:


Product version and edition Databases
SharePoint Foundation 2010 Configuration
Central Administration content
Content (one or more)
Usage and Health Data Collection
Business Data Connectivity
Application Registry service (if upgrading from Microsoft Office SharePoint Server 2007 Business Data Catalog)
Subscription Settings service (if it is enabled through Windows PowerShell)
Additional databases for SharePoint Server 2010 Standard editionSearch service application:
  • Search administration
  • Crawl (one or more)
  • Property (one or more)
User Profile service application:
  • Profile
  • Synchronization
  • Social tagging
Web analytics service application
  • Staging
  • Reporting
Secure store
State
Managed Metadata
Word Automation services
Additional databases for SharePoint Server 2010 Enterprise editionPerformancePoint
Additional databases for Project Server 2010Draft
Published
Archive
Reporting
Additional database for FAST Search ServerSearch administration

For details, go to this link.

Tuesday, May 15, 2012

Rotating images using JQuery and Data View Web Part in SharePoint Foundation 2010

This post is about rotating images with fixed captions in SharePoint Foundation 2010. There are a few posts around which talks about gettting it done but doesn't work properly so thought to write a step-by-step blog on it.

Note: You can also rotate images using Content query web part (link), but for that you should have SharePoint Server 2010, as content query web part doesn't come with SharePoint foundation 2010!

Requirements:
- Download jquery-1.7.2.min.js
- Download captify.tiny.js (for fixed caption)
- Create a picture library or use the default one and put some pictures into it.
Keep both JQuery files in the <14 hive>\Templates\Layouts\JQuery (create this folder if doesn't exist)

1. Create a new site page.

2. Now edit page in normal mode in SharePoint designer. Put your cursor before SPAN tag with id 'layoutsData' and insert an Empty Data View.

Switch to 'Split' mode, click 'Click here to select a data source' and select the picture library.
Select 'Title' for image caption and 'URL Path' for link to image. Now insert selected fields as multiple item view. It will insert complete xslt required for rendering the picture library on page.

Switch to 'Code' view. Automatically generated code contains few XSLT tag which are of no use in our case so I have removed these. Select automatically generated <XSL> tag and overwrite it with the <XSL> tag given below.


<!----- XSL Tag: START ------>


<Xsl>

 <xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">    
 <xsl:output method="html" indent="no"/>    
 <xsl:decimal-format NaN=""/>    
 <xsl:param name="dvt_apos">'</xsl:param>    
 <xsl:variable name="dvt_1_automode">0</xsl:variable>   
  <xsl:template match="/" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsoft.SharePoint.WebControls">        
 <xsl:call-template name="dvt_1"/>    
 </xsl:template>    
 <xsl:template name="dvt_1">        
 <xsl:variable name="dvt_StyleName">Table</xsl:variable>        
 <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>        
 <xsl:variable name="dvt_RowCount" select="count($Rows)" />        
 <xsl:variable name="IsEmpty" select="$dvt_RowCount = 0" />

<!-- Jquery file and plugin reference -->
 <script type="text/javascript" src="_layouts/JQuery/jquery-1.7.2.min.js"></script>
 <script type="text/javascript" src="_layouts/JQuery/captify.tiny.js"></script>

 <script type="text/javascript">

  $(window).load(function() {
   

   // This code provides the fade-in and hide effect on regular interval
   var InfiniteRotator =    
       {
           init: function()
           {            

                 //initial fade-in time (in milliseconds)
               var initialFadeIn = 1000;
                 //interval between items (in milliseconds)
               var itemInterval = 5000;
                 //cross-fade time (in milliseconds)
               var fadeTime = 2500;
                 //count number of items
               var numberOfItems = $('#headers li').length;
                 //set current item
               var currentItem = 0;
               if(numberOfItems &gt; 0) {
                //show first item              
                $('#headers li').hide();
                              
                $('#headers li').eq(currentItem).fadeIn(fadeTime);
               
                //$('#headers li').eq(currentItem).fadeOut(fadeTime);
               
                if(numberOfItems &gt; 1)
                {
                 //loop through the items
                 var infiniteLoop = setInterval(function(){
                     $('#headers li').hide();                  
                       if(currentItem == numberOfItems -1){
                         currentItem = 0;
                     }else{
                         currentItem++;
                     }
                     $('#headers li').eq(currentItem).fadeIn(fadeTime);                  
                    
                 }, itemInterval);
                }
               }
               else {                 
                $('#headers').append('<li><span>No images.</span></li>');
               }
           }
       };
      InfiniteRotator.init();
    
     });
   
 </script>

 <script type="text/javascript">  

  $(function(){$('img.captify').captify({
    speedOver: 'fast', 
    // speed of the mouseout effect 
    speedOut: 'normal', 
    // how long to delay the hiding of the caption after mouseout (ms) 
    hideDelay: 500,  
    // 'fade', 'slide', 'always-on' 
    animation: 'always-on',   
    // text/html to be placed at the beginning of every caption 
    prefix: '',   
    // opacity of the caption on mouse over 
    opacity: '0.7',      
    // the name of the CSS class to apply to the caption box 
    className: 'caption-bottom',  
    // position of the caption (top or bottom) 
    position: 'bottom', 
    // caption span % of the image 
    spanWidth: '100%'
  }); });       
     
     
 </script>

 <style type="text/css">
 /*********** CAPTIFY CAPTION ***************/
 .caption-top, .caption-bottom {
       background: #000000;     
       color: #ffffff;     
       cursor:default;     
       padding:2px;     
       font-size:11px;     
       text-align:center;
       }  
 .caption-top {
       border-width:0px;
 }  
 .caption-bottom {
       border-width:0px;
 }  
 .caption a, .caption a {
       background:#000;     
       border:none;     
       text-decoration:none;    
        padding:2px;
 }  
 .caption a:hover, .caption a:hover {
       background:#202020;
 }

 #headers, #headers li{
      margin:0;    
      padding:0;    
      list-style:none;    
 }
 #headers li img{    
  display:none; /* hide the items at first only */       
 }
 #rotating-item-wrapper {
     position: relative;
 }

 </style>

 <ul id="headers">   
  <xsl:call-template name="dvt_1.body">    
    <xsl:with-param name="Rows" select="$Rows"/>    
  </xsl:call-template>
 </ul>
 
 </xsl:template>    

 <xsl:template name="dvt_1.body">        
   <xsl:param name="Rows"/>        
     <xsl:for-each select="$Rows">            
       <xsl:call-template name="dvt_1.rowview" />        
     </xsl:for-each>   
 </xsl:template>
  
 <xsl:template name="dvt_1.rowview">
   <div id="rotating-item-wrapper{generate-id()}">
     <li>
       <img src="
{@FileRef}" class="captify" alt="{@Title}"/>
     </li>
   </div>

</xsl:template>

</xsl:stylesheet>

</Xsl>


<!----- XSL Tag : END ------>

Note : For your information, I have highlighted the text which is inserted after cleaning the xslt code.


Done! Just save the page and navigate to it. You should be able to see images fadding in with a regular interval having fixed caption.

Additional Notes : You can also filter the images/items by providing required filter criteria in this tag:

<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[<filter_criteria>]"/>

Please let me know if you have any query.

References:
  • link to rotate images infinitely.
  • link to captify images.
Result:


Visual Studio 11 Beta - What's new in SharePoint Developer tools

Here are the most attractive features which are available/supported in Visual Studio 11 Beta:

1. SharePoint Lists and content types can be visually created using SharePoint List Designer in Visual Studio 11 Beta.

2. NowVisual Web Parts support sandbox solutions deployment

3. Silverlight web parts are available

4. SharePoint solutions can now be published to remote SharePoint server, no matter if it's on-primises or Office 365 (SharePoint Online), remote or local.

5. Full in-built support for performance testing of SharePoint Solutions in Visual studio.

6. Better intellisense and debugging support for Javascript solutions.

7. Right API intellisense for Sandbox solutions. So no need to worry if included API will work in Sandbox solution or not.

Quite interesting list !

For further details you can refer SharePoint Developer Team blog here.

Tuesday, May 8, 2012

Error occurred in deployment step ‘Recycle IIS Application Pool’: The local SharePoint server is not available.

While deploying a solution to sharepoint 2010, if user gets an error like "Error occurred in deployment step ‘Recycle IIS Application Pool’: The local SharePoint server is not available".

It means that account doesn't has sufficient rights to deploy a solution.

To solve the issue, you need to run Add-SPShellAdmin powershell command providing user name and content database GUID.

Syntax :
Add-SPShellAdmin -UserName user_name -database db_guid

[You can use Get-SPDatabase to get GUID for your content database. Make sure user running this command has permissions on SQL Server Database]

What it does?

i.) Add the user into WSS_Admin_WPG role
ii.) Provide him/her 'dbowner' and 'SharePoint_Shell_Access' permission in following databases :
  • Provided database in parameter.
  • SharePoint_AdminContent_<guid>
  • SharePoint_Config
I inspired to write this post from this link

Friday, May 4, 2012

Quick launch shows sites and page regardless of navigation settings

To resolve this issue, please make sure data source for quick launch navigation is surround by these tags:

<SharePoint:DelegateControl....>
  <Template_Controls>
     //Quick launch site map data source
  </Template_Controls>
</SharePoint:DelegateContol>

See the sample code below:

<SharePoint:DelegateControl runat="server" ControlId="QuickLaunchDataSource">
    <Template_Controls>
       <asp:SiteMapDataSource
       SiteMapProvider="SPNavigationProvider"
       ShowStartingNode="False"
       id="QuickLaunchSiteMap"
       StartingNodeUrl="sid:1025"
       runat="server"/>
    </Template_Controls>
 </SharePoint:DelegateControl>  

Monday, April 23, 2012

Checking Programatically, if Document Library Folder is Hidden

SPFolder doesn't expose any direct property which can be used to analyze if the folder is hidden.

I got stuck into this and could get any solution from Internet also. So decided to write this blog post.

At some places, people are talking about analyzing SPFolder.Properties.Count which should be equal to 21 if the folder is visible. Unfortunately, that's not true !

While looking at SPFolder properties for a hidden folder, I came across 'Item' property (SPListItem type).

For hidden folders, this property was Null regardless of the content in that folder.

For visible folder, it was either 0 or greater than 0 but was not Null even if folder is empty.

So in my view, you should always use 'Item' property of SPFolder to analyze its visibility as follows:

If(SPFolderObj.Item == Null)

//This folder is hidden

Else

//This folder is Visible

Tuesday, April 17, 2012

Error on opening _layouts/ChangeSiteMasterPage.aspx

You created a custom master page in SharePoint designer 2010 and now want to apply it on subsites. What you will do?
One way is that directly navigate to http://server_name/subsite_name/_layouts/ChangeSiteMasterPage.aspx and change the master page.

Now, here is the problem !
If you haven't activated 'SharePoint Server Publishing Infrastructure', you will get an error screen (may be without giving you any details about error excepting the correlation Id !)

To activate 'SharePoint Server Publishing Infrastructure' feature, follow steps given below :
1. Navigate to 'Site Settings' of site collection
2. Click 'Site Collection Features' (in the secton 'Site Collection Administration')
3. Activate the 'SharePoint Server Publishing Infrastructure' feature.

Good luck!

 

Monday, April 16, 2012

New line in XPath expression in SharePoint Designer

Recently, while designing Data View Web Part with the help of SharePoint designer I had to concatenate two fields value with a line feed between them.

BTW, it has been my painful experience of putting a line feed in XPath expression.

After a lots of research I found that you can put '&#xA;'. So if you have to give a line break between two fields values then your expression would be something like this:
{@field1,'&#xA;', @field2}

For detailed solution, refer this link : http://www.infopathdev.com/forums/t/2013.aspx

Thursday, April 12, 2012

Weather RSS feeds : Which one to choose?

Yahoo
Google
Weather channel
WeatherZone
..and the list goes on!

In my view, Yahoo weather feeds are the best one (powered by Wheather Channel) and provide fastest updates. But wait ! You can not use them for commerical purpose. See their Terms of use here : http://developer.yahoo.com/weather/

Google weather APIs are used for iGoogle and are private to them. So can't use!

Weather channel is the paid one.

WeatherZone can be the best choice although provide updates later then Yahoo. But you can use them on your website (not mentioning any non-commercial/non-profit like stuff). You can see their terms of use on this link : http://www.weatherzone.com.au/services/rss.jsp

If you have any weather API/feed please share its detail here.

System.Net.WebPermission error in deploying a sandbox solution

You have deployed you sandbox solution successfully. And you see this permission error while inserting your web part:
Request for the permission of the type 'System.Net.WebPermission, System, Version 2.0.0.0, Culture-neutral, PublicKeyToken=b77a5c561934e089' failed.

It means that your sandbox solution is trying to access some resources which are not permitted.

Simply, change your Sandbox solution to Farm solution (steps given below) and probably, the error would disappear.

Convert Sandbox solution to Farm solution:
  • Click your project
  • Press F4 (or go to project properties)
  • Change Sandbox Solution to False.