Monday, 3 March 2014

SharePoint crawl: Access is denied. Verify that either the Default Content Access Account has access to this repository



  • Give Read permission to Search Access Account in your Web Application
  • Select User Profile Service Application and Click on Administrators in the ribbon. Add Search Access Account and select  'Retrieve People Data for Search Crawlers'

  • Add DisableLoopbackCheck and BackConnectionHostNames entries to WFE's
  • Add host file entries to WFE's
  • Restart SharePoint Server Search Service
  • Start a new Crawl

Tuesday, 4 February 2014

SharePoint People Picker Filter

We had an issue where some users show up twice in the People picker search and it happen to be one of them from another domain and that domain is a trusted domain of the main domain which is used for SharePoint.
As a result of that, when ever user search for some one it gives two results in the People picker.
ex\ search Ed show - ABC\ed and DEF\ed

DEF is a completely separate AD which is used in the Dev environment. This is a trusted domain in the ABC and that cannot be removed due to few other reasons.
Fastest solution was to filter the People picker to show users only from ABC domain.

Setting the filter is limited to the Web application and need to be executed for each web app.


$webapp = Get-SPWebApplication http://siteurl
$webapp.PeoplePickerSettings 
 
$webapp.PeoplePickerSettings.
ActiveDirectoryCustomFilter = 
"(userPrincipalName=*@ABC.local)"
$webapp.Update() 

Two good references for filtering are

http://sharepointserver-2007.blogspot.co.uk/2008/10/limiting-sharepoint-people-picker.html

http://www.sharepointdiary.com/2012/04/people-picker-filter-in-sharepoint.html


Can use following to check the output before setting the filter

$strFilter = "(&(&(objectcategory=person)(!sAMAccountName=*_ssl))(userPrincipalName=*@ABC.local))"
$objDomain = New-Object System.DirectoryServices.DirectoryEntry

$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $objDomain
$objSearcher.PageSize = 1000
$objSearcher.Filter = $strFilter
$objSearcher.SearchScope = "Subtree"

$colProplist = "name"
foreach ($i in $colPropList){$objSearcher.PropertiesToLoad.Add($i)}

$colResults = $objSearcher.FindAll()

foreach ($objResult in $colResults)
    {$objItem = $objResult.Properties; $objItem.name}

Monday, 2 December 2013

Unable to deactivate and delete sandbox solution: Unable to access web scoped feature

Get 'Unable to access web scoped feature ...' when trying to deactivate a solution. (Sandbox)

This is mainly happening for list/ site templates and the reason is that there are some lists/sites which has been created using that solution and now been deleted and still in the Recycle bin. 

Solution is to Empty the Recycle bin. 

SharePoint 2010: Error exporting the list named "Posts" at the URL: Lists/Posts

This is something I came across while trying to save a Blog/ Discussion forum as a template. This template has gone through several revisions and this is the first time that I came across the error.

I tried following solutions which I found on the web.

However, NONE of those has worked for me and ended up creating a new Blog site from the default template and redoing the custom changes.
So, if you come across the same error, better trying following two solutions and if didn't work, go back to recreating from the base.

------------------------------------------------------------------------
http://blogs.microsoft.co.il/choroshin/2012/09/04/sharepoint-save-site-as-template-common-errorsmistakes/
4) Save as site template SharePoint 2010 Blog.
The Problem
When trying to save blog as site template the posts list appear 5 times in the site as 5 different views.
The Solution
The workaround that Manas found is:
a) Navigate to “View all site content “.
b) Select one of the “Posts” >>navigate to its “List settings” .
c) Further go down into “My  Posts” List and select the option “Make this as default view “.
d) now you would see only one “Posts” list.
5) Getting “Error exporting the list named “Announcements” at the URL: Lists/Announcements” error when trying to save as site template.
The Problem
When creating a site as web template and then creating sub sites which you wish to save as a web template you receive the following error “Error exporting the list named “Announcements” at the URL: Lists/Announcements”.
The Solution
As posted by Jonathan Adams in this great post
Run the SharePoint 2010 Management Shell as Administrator.  Run the following command to disable the default content type feature:
Disable-SPFeature –Identity ctypes –url http://SiteCollection
Then enable the content type feature:
Enable-SPFeature –Identity ctypes –url http://SiteCollection
Try saving the subsite as a template again, it should succeed.

Friday, 16 July 2010

All about SPField - Internal Name, Display Name, & GUID

First of all, Thank goes to Ken for the investigation.

Few words on the web about internal, static and display names of columns. There aren’t any simple Microsoft statement on the subject


Create Site Column through GUI:

-- DisplayName must be unique. SharePoint will adjust StaticName & InternalName to keep them unique.

Create Site Column through Feature and XML:

-- xml-Name (InternalName) must be unique. SharePoint will allow duplicate DisplayName & StaticName.
*** Duplicate Internal names will not create a field (If you already have a site field with the same Internal Name). “No error will be raised”.

Create List Column through GUI:

-- DisplayName must be unique. SharePoint will adjust StaticName & InternalName to keep them unique.

Adding site columns to list columns via GUI:

-- DisplayName and StaticName don't have to be unique. SharePoint will make InternalName unique.


Source: http://www.sharepointlessonslearned.com/blogs/blog1.php/2010/03/04/field-name-uniqueness-rules-vary-between-gui-and-api


In addition to that:

** Content types that refer to the missing field will have orphaned local field, and the list will continue to function.

** Fields created from code (Fields.AddFieldAsXml) - These will raise an error if internal name exists.

** Fields created from code (Fields.Add) - Sharepoint makes unique name.

Wednesday, 3 February 2010

Adding event receivers to custom list templates

Problem: wanted to create a list template and with some event receivers.

Normally I use the SharePoint Solution Generator to dump the list templates. So I have created a list using GUI and added some event receivers and used the SSG to generate the template. (I got my 4 aspx files and the schema.xml)




When you check the schema, you can see that the Event receivers are correctly added under the <Receivers> tag. So I have used a feature to deploy the list template and created a list using deployed template. List was created successfully with all the fields and views, but unfortunately my Event receivers were missing. I doubled checked and tried again, got the same results.

While googleing, found an article which you can use a separate Elements file to bind the Event receivers to particular list type.

I have use the same method and its working with the list template. In addition to that it adds the event receivers to list which are already created through my custom template.

Note that you need to correctly match the ListTemplateOwner and ListTemplateId





So, basically this registers the event receivers based on the list type and you can use this to add event receivers to existing custom list by just creating a feature, rather than writing new codes.

Friday, 20 November 2009

You call this Cheat (or cheap) coding or smart coding

c# split string but keep split chars/ parameter


Today I came across a situ that I had to split a string based on ‘-‘ and keep the split char in the array as well.

Ex\ Split A-B-C-D to a string array with A,-,B,-,C,-,D

If I use the String.Split function with ‘-‘, it will only return the A,B,C,D without my split char.

So I decided to google, and I got nice long functions using regular expressions and substrings.

I didn’t want all those code in to do a simple thing like this and I went on cheating with Split function.



Number.Replace("-", ":-:").Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries)


so, am I cheating?