Who's Online
14 visitors online now
0 guests, 14 bots, 0 members
Support my Sponsor
  • An error has occurred, which probably means the feed is down. Try again later.

Archive for the ‘SharePoint’ Category

Create a custom MySite host template in SharePoint 2010 and SharePoint 2013

Here I will show you how to create new mysites host. Once you apply this mysite site host template, all new mysite will use this as a tempate to create a mysite

  1. Create a new Mysite host.
    a. Open Central admin > Application management > Create new site collection
    0105
    b. Provider Name, URL path, Select template as “My site host” and a site collection admin > Click OK
    0106
    c. Now you can make the required modification(e.g. custom master page, custom list, library, webpart, etc) in this mysite template.

  2. Update this Mysite Host site in User profile service application
    a. Open Central admin > Application management > Manage service application > User profile service application
    0107
    b. Under My site settings select “Setup My sites” > In my site host select the new mysite host we just created e.g. http://portal/sites/host > Click ok
    C. Now all new my Site collections will use this as Host template
    0108

Note. This mysite host does not work on existing site. It only works on new mysites.

Setup Shared mailbox in Sharpoint 2013 to Exchange 2013 Oauth

When run the ./Set-SiteMailboxConfig.ps1 -ExchangeSiteMailboxDomain ‘domain name’ -WebApplicationUrl ‘SiteURL’
It gives 2 errors:
1) App management shared service proxy is not installed
(it was installed so this was not the actual error)

2) Cannot validate argument on parameter ‘App principal’. The argument is null. Supply a non-null argument and try the command again.
Error 2 was something interesting so we started to troubleshoot second error. Run powershell command Get-SPTrustedSecurityTokenIssuer

Realized there were 3 in the list and 1 of them was having NameID as null. Other STSs were from WorkFlow Manager.

Deleted all STSs with this command (note, all other services which use the STS will be affected if u do this. in my case i have to re register the WF manager)

Get-SPTrustedSecurityTokenIssuer | Remove-SPTrustedSecurityTokenIssuer –Confirm:$True
After that we run below commands to get a new STS and make sure the name id is not null
$exchange=Get-SPTrustedSecurityTokenIssuer
$app=Get-SPAppPrincipal -Site ‘web app URL’ -NameIdentifier $exchange.NameId
$site=Get-SPSite ‘root site URL’
Set-SPAppPrincipalPermission -AppPrincipal $app -Site $site.RootWeb -Scope sitesubscription -Right fullcontrol -EnableAppOnlyPolicy
Now when we run the set script again it works fine but when try to use the mailbox in SharePoint got error code 10 instead of error code0.

Asked the exchange team to run the oAuth command for this SharePoint Web Application Again.

Wait for a couple of hours so that it gets replicated on both nodes of the exchange farm.

3) Also check if the App Management Proxy is added to your specific Web Application by going to Central Administration -> Manage Web Application -> Select your Web Application.

In the ribbon, click “Service connections”. Make sure the “App Management Service Application Proxy” is selected for your Web Application. If it’s not, add it to the proxy group.

Now when i try to use the Site MailBox…it works!!!

SharePoint 2010 \ 2013 warm up scripts using Powershell

SharePoint app pools recycle every night so that old data is flushed and cache is cleared. It is also important from secruity aspects. But because they recycle every night the first person to hit SharePoint each morning has to wait for the app pools to warm back up, which makes them cranky. Over the years a variety of startup scripts have been written to address this, and they all work to varying degrees.

Server Side Warm script

THis script will request the default page of the root site collection of each web application in your farm:
############## Script 1 #################
Get-SPWebApplication | ForEach-Object { Invoke-WebRequest $_.url -UseDefaultCredentials -UseBasicParsing }
############## Script 1 #################

The –UseDefaultCredentials parameter tells Invoke-WebRequest to log in to the web site as the person that PowerShell is running as. –UseBasicParsing tells Invoke-WebRequest to use basic parsing of the web page. We really don’t care about the web page, we just want to wake SharePoint up to send it to us.
You can also try below Warm up script and check if can be of any help.
This passes in the default credentials needed. If you need specific stuff you can use something else to elevate basically the permissions. Or run this task as a user that has a Policy above all the Web Applications with the correct permissions
############## Script 2 #################
$cred = [System.Net.CredentialCache]::DefaultCredentials;
$cred = new-object System.Net.NetworkCredential(“username”,”password”,”machinename”)[xml]$x=stsadm -o enumzoneurls

foreach ($zone in $x.ZoneUrls.Collection)
{
[xml]$sites=stsadm -o enumsites -url $zone.Default;
foreach ($site in $sites.Sites.Site)
{
write-host $site.Url;
$html=get-webpage -url $site.Url -cred $cred;
}
}
############## Script 2 #################
The next script is completely Powershell from http://www.jonthenerd.com/2011/04/19/easy-sharepoint-2010-warmup-script-using-powershell/

############## Script 3 #################
Add-PSSnapin Microsoft.SharePoint.PowerShell;

function Get-WebPage([string]$url)
{
$wc = new-object net.webclient;
$wc.credentials = [System.Net.CredentialCache]::DefaultCredentials;
$pageContents = $wc.DownloadString($url);
$wc.Dispose();
return $pageContents;
}

Get-SPAlternateUrl -Zone Default | foreach-object
{
write-host $.IncomingUrl;
$html = Get-WebPage -url $
.IncomingUrl;
}

############## Script 3 #################

SharePoint 2010 \ 2013 Create a SharePoint Site Collection with a custom Template using Powershell

Save the custom site with all custom list\library etc as .wsp. To do so follow below:
1. Go to Site action > Site settings > Save site as template

0103

  1. Mention the name of template and select “Include content” > Click OK
    0104

  2. Once the site is saved, you will get link for “Solution gallery”. Go to Solution gallery and download the teamplate (temp.wsp) file to something like d:\temp.wsp.

You need to write powershell in 2 parts. One will create site collection and other will apply custom template.
1st Part of Powershell

Start Part 1 Create a SharePoint Site Collection with a custom Template using Powershell

Write-Host “Provide the site collection URL e.g. http://intranet/site/custom”
$Siteurl = read-host

Write-Host “Provide the site collection owner email address”
$owner = read-host

New-SPSite $Siteurl -OwnerAlias $owner -Name “This will have a custom template”

End Part 1 Create a SharePoint Site Collection with a custom Template using Powershell

Now we have to add our WSP to the Solution Gallery in the Site Collection. I have a do While loop to make sure that the solution has been uploaded successfully before activating it.

##### Start Part 2 Create a SharePoint Site Collection with a custom Template using Powershell ##############
Add-SPUserSolution -LiteralPath d:\temp.wsp -Site $Siteurl
$ErrorActionPreference = “silentlycontinue”
do
{
Write-Host “.” -NoNewline -ForeGroundColor White;
Start-Sleep -Seconds 5;
try
{
$testsolution = Get-SPUserSolution -Identity temp.wsp -Site $Siteurl
}
catch
{}
} while(!$testsolution);
$ErrorActionPreference = “stop”
Install-SPUserSolution -Identity temp.wsp -Site $Siteurl
Write-Host “Site collection with custom template is created”

End Part 2 Create a SharePoint Site Collection with a custom Template using Powershell

Note that the Template GUID and Name will never change. So if you want to send the script and the package to someone else, you can hard code this part and it will work no problem.

User Profile Synchronization Service Gets Stuck on Starting SharePoint 2010 \ 2013

For some reason once you provision the User Profile Service Application the User Profile Synchronization Service gets stuck on Starting, and it can’t be stopped in Central Administration. After some research on User Profile Synchronization service I found that when we Start the UPA sync service in “Services on Server” a series of tasks executes which includes Forefront Identity Manager setup. It means setting up windows services, certificates, installing database schemas, registry changes, etc. If it ails at any stage, it will try again nearly 15 times and shows failure after 15 attempt. This is the reason it appears to be “stuck” when in fact its attempting each of the runs. After around 20 to 45 minutes the status will return to Stopped, and you can attempt to start it again.

Observed that some try to reboot the server to get rid of this issue, but it still remain as “Starting” even after reboots. Now this is not a good sign because apparently a very common issue and I have even heard of people re-building SharePoint Servers to fix the issue. Here you might loss data \ settings configuered in UPA if you have to recreate UPA.

Below steps will help you start the UPA service which was stuck on starting which was working fine previously but if its a new setup then I would recemmond you to try create a new UPA service and try below.
Some cause and solutin to this issue
1. Permissions issues:
Incorrect Permissions are most known cause of “Stuck on Starting” behaviour. There is no work around for same. If you don’t set the permissions correctly things won’t work, pretty simple.

We need two accounts to configure UPS Service viz. UPS Service Instance Service Identity which run the FIM services (It is also Farm Account) and Synchronization Connection account, this is the account which actually performs the sync.

You must run the UPS Service Instance as the Farm Account. Just because its possible to change the service identity in Manage Service Accounts, doesn’t mean it will work, and more importantly it is unsupported. So don’t change it.
Next, the Farm Account must be a local administrator of the machine running the UPS Service Instance during provisioning only. When we hit Start in Services in Server a series of tasks are run, which are akin to running the second stage of the Forefront Identity Manager setup. Many of these tasks require local machine administrator rights. You must grant this right before hitting start, and more importantly they must be applied. As the Farm Account is running services on your box (SPTimerV4 and the Central Admin app pool) we must simulate a log off and log on for the change in rights to be applied. You can do this by restarting SPTimerV4, or better yet, rebooting the machine. Once UPS is provisioned you can remove the Farm Account from the local administrators group.

Note: Any event in your farm that requires the UPS service instance to be provisioned will require the Farm Account be a local admin. Such events include the re provisioning of the service instance following the deployment of a SharePoint Cumulative Update and performing a Farm Backup from Central Administration (which stops and starts the UPS service instance). Don’t forget to ensure that the correct rights are assigned (and actually taking effect) when planning and scheduling your farm operational maintenance tasks.

Farm Account must have Log on Locally rights on the machine running the UPS Service Instance. Now be careful, you may think the account has these rights, and it will do if you made it a local administrator. However once you remove the admin rights, you may not have Log On Locally. If you don’t various operations will fail.

Very importantly make sure that Synchronization Connection Account must have Replicating Directory Changes on the Domain you are syncing with. It is the only way sync will work. It’s a hard requirement. Despite the scary name the Replicating Directory Changes permission makes zero changes to AD. It provides a change log capability, which improves the speed of operations such as Sync.

If you are syncing with a Windows Server 2003 functional level domain, the Synchronization Connection Account must be a member of the Pre-Windows 2000 Compatible Access group.

If you wish to do an Export, the Synchronization Connection account must have Create Child Objects and Write permissions on the OUs you are syncing with. Watch out for a common gotcha, that these rights are set on the container level only, you must ensure that This object and all descendants is selected.
2. SQL server 2014:
Environment : If you are using SQL 2014 with SharePoint 2013 or SharePoint 2010

Error : The Open Procedure for service “WmiApRpl” in DLL “C:\Windows\system32\wbem\wmiaprpl.dll” failed. Performance data for this service will not be available. The first four bytes (DWORD) of the Data section contains the error code

Performance counters for the FIMSynchronizationService (Forefront Identity Manager Synchronization Service) service are already in the registry, no need to reinstall. This only happens when you install the same counter twice. The second time install will generate this event.

Unable to open the Server service performance object. The first four bytes (DWORD) of the Data section contains the status code

Solution :
The issue can be resolved by downloading any of the CU updates from April 2014 CU and running PSConfig. Once the CU has been deployed, go through the usual process of starting User Profile Synchronization Service from Central Admin. The issue arises due to the use of SQL 2014

Note: I always recemmond you to install latest updates on all sharepoint servers
3. Environment : SharePoint 2010
Error : Attempting to Manage the UPA, you receive an error, Not Found, Correlation ID: [guid], or Could not load file or assembly ‘Microsoft.ResourceManagement’

SOlution:
Try below updates to resolve the issue
KB2281364 ( Description of the SharePoint Server 2010 hotfix package (wosrv-x-none.msp, pplwfe-x-none.msp, osrv-x-none.msp): July 21, 2010)

KB983497 ( Description of the SharePoint Server 2010 hotfix package (Osrchwfe-x-none.msp;Pplwfe-x-none.msp;Spswfe-x-none.msp): June 29, 2010 )

Note: I always recemmond you to install latest updates on all sharepoint servers
4. If you are not able to resolve the issue and you want to create a new uPA service, Try to stop the User Profile Synchronization Service you need to run a Powershell Command.

a. Open up Powershell on your SharePoint Server and type in the following command
Get-spserviceinstance

b. This will list out all of the services on your SharePoint Server with their associated GUID’s. Copy the GUID for the User Profile Synchronization Service.

c. Then run the following command to stop the User Profile Synchronization Service.

Stop-spserviceinstance <GUID>

d. Now go back into Central Administration > Application Management > Manage Service Applications and delete the User Profile Service Application.

e. Restart your server and set up the User Profile Service Application again.
http://www.harbar.net/articles/sp2010ups2.aspx
http://blogs.technet.com/b/scottstewart/archive/2014/10/30/user-profile-service-stuck-on-starting.aspx

Create \ Extend a SharePoint 2010 \ 2013 site for Internet (extranet)

This works for both SharePoint 2010 and SharePoint 2013

Normally web application on SharePoint server are created for internal (intranet) access only. If you want to extend this web application and access it from internet out side your organisation, you need to follow below.

If you just created Alternate Access Mapping in Central Admin, it will not work for you and you might end up facing issues.

Lets assume that your web application on port 20000 configured with windows or form based authentication.
1. Open Central administration -> Manage web application
2. Select your web application with Port 20000 -> Click EXTEND from top ribbon and enter the information for port you want to use.
0099
Note: YOu will have to enter the host header(e.g. internet.domain.com). Port number should be 80
3. For Anonymous choose Yes, one thing here you must enable anonymous access of the web application that you are going to put internet.
0100
4. Select authentication method, which is windows with default values and Enable form based authentication as well.
5. For form based authentication enter the membership and role provider.
0101
6. Select Internet Zone from Public URL section and click OK.
7. Extend web application – choose zone
0102
8. System will create the IIS website with the host header you entered. If you are on different port rather that 80 don’t forget to add that port to firewall exception.
9. Now you can browse your site from the internet using the url like http://internet.domain.com
Note: You can use form based authentication for the internet facing web application to ensure security.

 

Bulk create items in SharePoint 2007 2010 2013 list

Hi Guys,

This article has some great link to articles which can help you create Bulk List items.

SharePoint PowerShell How To: Create SharePoint List Items (in Root and in Folders) for Load/Performance Testing
https://camerondwyer.wordpress.com/2014/05/09/sharepoint-powershell-how-to-create-sharepoint-list-items-in-root-and-in-folders-for-loadperformance-testing/

SharePoint 2007/2010 – Powershell script for bulk populating a List
http://saurabhmoss.wordpress.com/2011/03/16/sharepoint-20072010-powershell-script-for-bulk-populating-a-list/

SharePoint – adding list items with Powershell using web services
http://blogs.technet.com/b/lukeb/archive/2011/03/14/sharepoint-adding-list-items-with-powershell.aspx

Batch Update SharePoint List Items using Powershell
http://suryapulipati.blogspot.com/2013/07/batch-update-sharepoint-list-items.html

Hope this will help you all

SharePoint server The search service is not able to connect to the machine that hosts the administration component. Verify that the administration component ‘GUID’ in search application ‘Search Service Application’ is in a good state and try again

Issue:
The search service is not able to connect to the machine that hosts the administration component. Verify that the administration component ‘GUID’ in search application ‘Search Service Application’ is in a good state and try again
In Farm Search Administration page when click on “Modify Topology” get error “An unhandled exception occurred in the user interface.Exception Information: Exception has been thrown by the target of an”

Cause: Search is not able to connect is because of many reasons, In this article I am providing all possible causes and the solutions.

Resolutions:
Solution 1: In the end it turns out to be that the application pool that hosts the search service application somehow doesn’t have the correct access.
You can simply change the application pool to use SharePoint Web Services System for search service applications and check.
1. Click on Start > Run > Type Inetmgr > Click OK0094

 

 

 

 

 

  1. In IIS > Expand server > Expand sites > Expand “SharePoint Web Services”
    0096

  2. Now check all the GUID 1 by 1 in content view unless you find searchadmin.svc and searchservice.svc
    0095

  3. Right click GUID go to advance settings
    0097

  4. Change the application to “SharePoint Web Services” > Click OK
    0098

Solution 2: enable the timer job and do IIS reset
1. Run below PS command to know the status of timer job
Get-SPTimerJob job-application-server-admin-service
Result ==> Is Disabled: True

  1. Run below PS command to enable the service.
    Enable-SPTimerJob job-application-server-admin-service
    Result ==> IsDisabled: False

  2. Do Net Stop sptimerv4

  3. Do Net start sptimerv4
  4. DO iisreset

Solution 3:Ensure the account has full control permissions on the Search service application and IIS account used by this service application
Follow below steps
1. Open Central Admin  > Select Security > Select “Configure service accounts”
0092

  1. Select the search service application
    0093

  2. For “select account for this component” Select a account which has full permission

SharePoint server 2010 \ 2013 \ Online with variation or multilingual site feature

The variations feature in SharePoint Server 2010 and SharePoint Server 2010 and SharePoint Online makes content available to specific audiences on different sites by syncing content from a source variation site to each target variation site. When users visit the root site, they are redirected to the appropriate variation site, based on the language setting of their web browser. Content on a target variation site can be translated into other languages before it is published. Variations can be used only on sites that are created by using one of the Publishing site templates, or on sites for which the SharePoint Server Publishing Infrastructure feature was activated.

It describes the elements of the variations feature; provides an overview of site, list, and page creation for variation sites; lists some limitations of variations; and describes scenarios for using variations in SharePoint. This article does not describe the tasks that are involved in planning a solution that uses variations. For information about how to plan to use variations in your solution, see Plan for variations in SharePoint Server 2013. This article also does not describe how to create variation labels and hierarchies. For information about how to create a variation site, see Create a multi-language website.

SharePoint Server 2013 has several features that enable you to support users in different regions or users who speak different languages. You can use these features to create websites in different languages and to enable users to view the user interface of a site in a language other than the one in which a site was created. If you plan to use variations with multilingual sites, there are additional steps that you must follow to enable multilingual support for the variation sites. For more information about how to plan multilingual sites, see Plan for multilingual sites in SharePoint 2013.

 

For more details
http://technet.microsoft.com/en-us/library/ff628966%28v=office.15%29.aspx

Difference between SharePoint hosted, Autohosted apps and SharePoint hosted apps

The following image can give you an overview of the entire app schema:

Following you can read the definition for each type of hosted app:

SharePoint hosted app
SharePoint-hosted apps, or apps where all components are hosted on either an on-premises or Office 365 SharePoint farm. SharePoint-hosted apps are installed on a SharePoint 2013 website, called the host web. They have their resources hosted on an isolated subsite of a host web, called the app web. It’s important to know the difference between host webs and app webs. .

Provider hosted apps
Provider-hosted apps for SharePoint include components that are deployed and hosted outside the SharePoint farm. They are installed to the host web, but their remote components are hosted on another server.

Autohosted apps
Autohosted apps for SharePoint are cloud-hosted apps whose remote components are provisioned and deployed for you on Windows Azure. As with a provider-hosted app, an autohosted app for SharePoint can interact with a SharePoint website but also uses resources and services that are located on a remote site that is hosted by Windows Azure. The SharePoint 2013 installation provisions and deploys these resources for you.

The main difference is that with auto-hosted apps all Windows Azure and Windows Azure SQL Database components are provisioned for you when the app is installed and the Windows Azure Web Sites infrastructure handles load balancing and other important maintenance tasks for you.

When using provider-hosted apps, you’re responsible for provisioning what’s necessary to support the app.

For more information, please: http://msdn.microsoft.com/en-us/library/office/fp179887(v=office.15).aspx