Thursday, 12 March 2015

Enable list and library Versions using PowerShell Script except the hidden lists

Using this script we can Enable Version with Major Version Limit under site content(Only visible list, not hidden list) all list and library

Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

$web = get-spsite "https://dotnetsharepoint.com/"

# For All Sub Sites
foreach ($spWeb in $web.AllWebs)
{
$lists = $spWeb.lists
foreach ($list in $lists)
{
#Only visible list under site contents
if(!$list.Hidden)
{
    # Enabling version   
    if($list.EnableVersioning -eq $false)
    {  
         write-host $list.title "Version Enabled for this site"
         $list.Enableversioning = $true
         $List.MajorVersionLimit = 5
         $list.update()
    }
}

}

}

Export user list from SharePoint groups using PowerShell script

 We can get all users from all groups in SharePoint using below script. Using the below script we can get sub rooms users also.
  
Add-PsSnapin Microsoft.SharePoint.PowerShell


$URL= "https://Dotnetsharepoint.com"

     $site = Get-SPSite $URL
   
     #Write the Header to "Tab Separated Text File"
        "Site Name `t Group Name `t User Name “| out-file "D:\SPUsersList.xslx"
       
     #Iterate through all Webs (All Sub rooms)
      foreach ($web in $site.AllWebs)
      {
        #Write the Header to "Tab Separated Text File"
        "$($web.title) `t" | out-file "D:\SPUsersList.xslx" -append

         #Get all Groups  
         foreach ($group in $Web.groups)
         {
                "`t `t $($Group.Name)" | out-file "D:\SPUsersList.xslx" -append
             
                        foreach ($user in $group.users)
                        {
                           #Exclude Built-in User Accounts                            

                                "`t `t `t $($user.name)" | out-file "D:\SPUsersList.xslx" -append
                        }
         }
     }

    write-host "Report Generated at D:\SPUsersList.xlsx"

Saturday, 28 February 2015

How to create result source in SharePoint

Result source is new in SharePoint 2013, using result source we can limit search results based on the search queries.

SharePoint 2010 search scopes are replaced by Result sources in SharePoint 2013.
In SharePoint 2013 provides 16 predefined results are given as shown in the below screen shot.



Local SharePoint Results are set to be a default result source we can also specify existing or custom newly created result source as default for a site collection or site.

To create a result source for a site collection.
Navigate to Site Settings->Search->Result Sources
Click on the Result Source there we can able to create a new result source.
In the General Information section Enter the name.
Click on the Launch Query Builder
By default we can able to see the screen shot shown below.
If you want to search only particular list items in our entire site using this result source.
In the Keyword filter “select only returns items” click on Add Keyword Filter.
In the Property Filter “Select the Path” Contains Manual Value Enter the List URL Click on Add Property Filter.
Click on Test Query we can see the Results Preview,
Keep the default setting as it is.
Click on Save.
Set as default resource source as shown.
Now if we search in our site we can get search results only in that particular list items in our entire site.

Moving User Profile Properties using PowerShell.

We created custom user profile properties in our SharePoint also we can check in our article How to Create Custom Properties in SharePoint.

 We want to move those properties to detail section in our SharePoint.
Using the OOTB feature we are moving UP by clicking the UP arrow, but some extend we are unable to move UP.  
There is way we can do using power shell.
Run the below script step by step.
Step 1:

$GetMySite = Get-SPSite <MySiteHostURL> #give here mysite url
$Getcontext = Get-SPServiceContext $GetMySite
$UserprofileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($Getcontext)

Step 2:
Here we can get all the properties with ID’s.
We can able to see our custom property with ID 5402.
When we are moving UP using OOTB UP arrow it was unable to go forward because of duplicate id will come when we are moving manually.



$userprofilemanager.properties | ft name,displayorder


Now we are  moving this to Detail section and also want to place after the SPS-Interests having the ID 5206.



Step:3

Now we will move the “Custom property test” after the Interests
We have to use only unique id so now using “5207"

$userprofilemanager.Properties.SetDisplayOrderByPropertyName(“CustomPropertyTest”,5207)
$userprofilemanager.Properties.CommitDisplayOrder()

finally reset the IIS once.

Now we can able to see the “Custom Property Test” in Details section without any issues.



Creating custom user profile property in SharePoint

To create a custom property in our SharePoint user profile service application.

Navigate to Central Admin->Application Management->Manage Service Applications->
Click on the User Profile Service Application.



Now Click on Manage User Properties.

There we can able see to create a New Property.

Click on the New Property
There I am entering the Name and Display Name as shown in the screen shot below.
Here we can change the length of the property and also Type as per requirement.
We can also change display settings and also change mapping to get the information from AD for this custom property also as per the requirement.
In our case we are keeping all the default settings.

Finally Click on OK.

Now we can able to see the custom property in the Custom Properties Section.


Tuesday, 24 February 2015

Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled. ( HttpStatusCode Unauthorized The request failed with HTTP status 401: Unauthorized.

We crawled people to get results while search, so we created a new content source and given the url
Sps3://dotnetsharepoint.com and started full crawling after 2 mins crawl completed and we can able to see the 1 error message at top level

Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled. ( HttpStatusCode Unauthorized The request failed with HTTP status 401: Unauthorized.; SearchID


Resolution:
We have to give the permissions for the user profile as shown in the below screen shot.
First we have to identify for which service account having permissions to retrieve people data.
Navigate to your search service application click on it there we can able to see the “Default content access account” with a service account, that account we have to give for our user profile service application
Navigate to the user profile Select the user profile in the top ribbon click on the administrator there we able to see the screen below.
Add the user and check the “Retrieve People Data for Search Crawlers” as shown below.
  
                        


Now crawl the people search again we can able to crawl without any issues.
   

Wednesday, 28 January 2015

The URL must be in one of the following zones: Local, Intranet


We configured the Performance Point Service and Secure Store Service for SharePoint Dashboard Designer.
How to configure Performance Point Service in SharePoint?

After completing all the configuration we tried to open the dashboard designer.
It was opened, but we are unable to see the SharePoint Option in that Designer.
Click on the Left hand side top “File Button”-> Designer Options.
In the Server tab give the SharePoint URL, click on connect.
 We are getting the warning message “The URL must be in one of the following zones: Local, Intranet”
                            

In my case we resolved the issue by adding the Site URL for Trusted Sites in the Internet Explorer,as shown below.



Please let us know, still you are facing any issues on this.

Here we find article How to Create a Dashboard Using BI in SharePoint?