Thursday, July 14, 2011

SharePoint and wWWHomePage property

SharePoint has the user profile property "Public Site Redirect" which gets the value imported from the wWWHomePage in Active Directory. This property is set when user selects the default my site.

When user creates/visits his my site he gets a popup message asking to save the current site as default my site. On clicking yes, this is updated in the registry and wWWHomePage field in AD. This works only if the user is using the Office 2007 and below. For users having Office 2010 it doesn't work. Office 2010 updates the registry but not AD. Microsoft has dropped this feature in Office 2010.

Read this blog for details:-  http://trevermoore.com/author/treverm/

Labels:

Monday, June 06, 2011

Control the contents to be indexed/crawled

In SharePoint, one can control what contents on the page needs to be indexed, should the links on the page to be crawled or not. Use the HTML <META > tag to tell the indexer whether you want to crawl the page contents or not.  You can also direct the indexer whether you want to crawl the links on the page or not.

For example:- <META name= "robots" content= "noindex, nofollow" > tells the indexer not to crawl the contents and don't crawl the links on the page.
Similarly <META name= "robots" content= "index, nofollow" > means crawl the contents but ignore the links on the page. 
<META name= "robots" content= "noindex, follow" > means don't crawl the contents but crawl the page contents whose links are present on this page.

By default the indexer will treat as content="index,follow" if nothing is specified as above.

You can further control the specific contents on the page to be crawled or not.  This can be achieved using the "noindex" class for the <div> tag.  Any content within the <div class="noindex" >
tags will not be crawled.  This is simlar to "noindex, nofollow" i.e. no contents will be crawled within that div tag and no links will be followed.

For example:-
<div class="noindex">
Contents in this div tag will not be crawled
This link will not be crawled too
</div>


But there is an exception to this.  The
<div class="noindex">
will not work in the nested div tags. 

For example:-
<div class="noindex">
<div>

Contents of this tag will be crawled as it is inside the child tag.
This link be crawled too
</div>
</div>

Labels: ,

Monday, May 30, 2011

Removing user from site using PowerShell

Remove-SPUser command is used to remove user from the site.


Remove-SPUser $useraccount -web $web -confirm:$false;

Labels:

Thursday, May 26, 2011

People Search and Bets Bets web part

Search Best Bets web part works only when it is added on the content search results page(results.aspx). This web part doesn't work when it is added on the people search results page(peopleresults.aspx). There are few other web parts whose behaviour changes based on which page layout it is added to in the search center.

Search Action Links web part is one of them. When it is added on the content search results page the sort options are different compared to when it is added on people search results page. On content search results page it give sort by Relevance and Modified date. Where as when it is on the people search results page it shows the sort by Default, Name and Social Distance.

Another major difference in web part's behaviour is of Refinement Panel web part (SharePoint 2010). Even if you add the People Refinement Panel web part on the content search results page, it behaves as normal refinement panel web part. This is same even after changing the Filter Category Definition of the web part.

Labels: ,

Wednesday, May 25, 2011

Adding user to a site using PowerShell

Started exploring the PowerShell commands on SharePoint 2010.

New-SPUser command is used to add user to the site.

Below script gets the .csv file as input parameter which contains the URL, domain account, permission level.

AddUsers.PS1
-----------------------------------------
param(
[String]$InputFile = ""
)

$SitesList = Import-CSV $InputFile;

ForEach ($s in $SitesList)
{
$web = Get-SPWeb -identity $s.URL;

New-SPUser $s.Useraccount -web $web -PermissionLevel $s.Permission -confirm:$false;

$web.Dispose();
}

"Complete";
-----------------------


Sites.csv
----------
URL,Useraccount,Permission
http://test.com/sites/xyz,domain\user1,Contribute
-----------

To run the command
PS> AddUsers.PS1 -InputFile Sites.csv

Labels: