Monday, March 31, 2014

Emails from "workflow@noreply" - SharePoint 2013

It was a bug in the SharePoint 2013 that workflows send emails from Workflow@noreply ... and this was actually fixed in the SharePoint 2013 March PU, the engine now will send as the outbound email address configured in the Central Administration.

Download SharePoint Updates from

Tuesday, March 25, 2014

Profile Pictures no longer display in MySites after moving MySite URL or changing web application in SharePoint 2013



2-    Stop the User Profile synchronization service
Central Administration > System Settings > Manage Services on Server > User Profile Synchronization Service > Stop

3-    You must disable My Site cleanup timer job before you reset the synchronization database. (Otherwise, the job will delete all user profiles and My Sites from the farm) and Disable User Profile Incremental Synchronization timer job
Central Administration > Monitoring > Review Job Definition > My Site Cleanup Job > Disable
Central Administration > Monitoring > Review Job Definition > User Profile Service Application Name-User Profile Incremental Synchronization > Disable

4-    Stop the SharePoint 2013 Timer Service
SharePoint 2013 Management Shell (Run as Administrator) > net stop sptimerv4

5-    Reset the Synchronization Database
a-    SharePoint 2013 Management Shell (Run as Administrator) > Get-SPDatabase
Then find the ID of Sync DB (Default name is Sync DB).
b-    SharePoint 2013 Management Shell (Run as Administrator) > Get-SPServiceApplication
Then find the ID of User Profile Service App.
c-     Copy the following code and paste it into a text editor and save it as ResetSyncDB.ps1 :
$syncid = “<id from step a>”
$upaid = "<id from step b>"
$syncdb=Get-SPDatabase $syncid
$syncdb.Unprovision()
$syncdb.Status='Offline'
$upa= Get-SPServiceApplication $upaid
$upa.ResetSynchronizationMachine()
$upa.ResetSynchronizationDatabase()
$syncdb.Provision()
d-    In SharePoint 2013 Management Shell change the directory the where you saved the ResetSyncDB.ps1
Then type: ./ResetSyncDB.ps1

e-    Using SQL Server Management Studio, create a login in SQL Server for the User Profile synchronization service account (that is, the farm account). Then, in the synchronization database, create a database user who maps to the login and grant it access to the db_owner database role. (See How to: Create a SQL Server LoginHow to: Create a Database User, and Database-Level Roles)

6-    Start the SharePoint 2013 Timer Service:
SharePoint 2013 Management Shell (Run as Administrator) > net start sptimerv4

7-    Start the User Profile synchronization service
Central Administration > System Settings > Manage Services on Server > User Profile Synchronization Service > Start

8-    Reset IIS:
SharePoint 2013 Management Shell (Run as Administrator) > iisreset

9-    Create connections to the data sources.
a-    Open User Profile Service Application Settings
Central Administration > Application Management > Service Application > Manage Service Application> User Profile Service Application
b-    Create New Synchronization Connection
Synchronization > Configure Synchronization Connection > Create New Connection

10-  Import Users Photos from Active Directory Into SharePoint
a-    in the User Profile Service Application Page
People > Manage User Properties > Picture > Edit
b-    Scroll down to the Add New Mapping section.  Choose your AD data connection, select the thumbnailPhoto attribute and click Add, followed by OK to save the change. This maps the SharePoint picture property to a user’s photo attribute in AD.

11-  Enable My Site Cleanup Timer Job and User Profile Incremental Synchronization timer job
a-    Run two full profile synchronizations.
b-    Once the second profile synchronization is finished, open the SharePoint 2013 Management Shell (Run as Administrator)
Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation <MySiteURL>
c-     After the second profile synchronization is finished;
Central Administration > Application Management > Service Application > Manage Service Application> User Profile Service Application > Manage User Profiles
d-    Next to View, select Profiles Missing from Import
e-    In the Find Profiles box, type the domain for the profiles and then click Find.
f-     For each profile that is returned, check the originating directory service, such as Active Directory, for the status of that profile. If the status of any of the returned profiles in the directory is not disabled or is not deleted, do not enable the My Site cleanup timer job (Ignore next step only). Contact Microsoft support for more assistance. Otherwise, enable the My Site cleanup timer job.
g-    Enable My Site Cleanup Job
Central Administration > Monitoring > Review Job Definition > My Site Cleanup Job > Enable
h-    Enable the User Profile Incremental Synchronization timer job
Central Administration > Monitoring > Review Job Definition > User Profile Service Application Name-User Profile Incremental Synchronization > Enable


Refrences:




Getting the GUID of a SharePoint site collection

You can get the GUID by the following ways:
1-   Powershell (SharePoint 2010):
PS > $mysite =  Get-SPSite <SITE_URL>
PS > $mysite.id

2-   Stsadm Command Line (MOSS 2007 & SharePoint 2010):
Stsadm -o enumsites -url <SITE_URL>

3-   SQL Server (MOSS 2007 & SharePoint 2010):
Run the following query on the designated content db:
select SiteId from Webs where webs.FullUrl Like '<SITE_URL>' AND ParentWebId IS NULL

Monday, March 24, 2014

Exporting SharePoint User Profiles to CSV Using Powershell


$siteUrl = "http://YOUR_HOSTNAME_HERE" $outputFile = "c:\temp\sharepoint_user_profiles.csv" Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue $serviceContext = Get-SPServiceContext -Site $siteUrl $profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext); $profiles = $profileManager.GetEnumerator() $fields = @( "SID", "ADGuid", "AccountName", "FirstName", "LastName", "PreferredName", "WorkPhone", "Office", "Department", "Title", "Manager", "AboutMe", "UserName", "SPS-Skills", "SPS-School", "SPS-Dotted-line", "SPS-Peers", "SPS-Responsibility", "SPS-PastProjects", "SPS-Interests", "SPS-SipAddress", "SPS-HireDate", "SPS-Location", "SPS-TimeZone", "SPS-StatusNotes", "Assistant", "WorkEmail", "SPS-ClaimID", "SPS-ClaimProviderID", "SPS-ClaimProviderType", "CellPhone", "Fax", "HomePhone", "PictureURL" ) erty.IsMultivalued) { $user.$field = $profil
$collection = @() foreach ($profile in $profiles) { $user = "" | select $fields foreach ($field in $fields) { if($profile[$field].Prope[$field] -join "|" } else { $user.$field = $profile[$field].Value } } $collection += $user } $collection | Export-Csv $outputFile -NoTypeInformation $collection | Out-GridView


Reference:

Wednesday, March 19, 2014

Deleting orphaned sites in SharePoint

If you have SharePoint 2007 database attached to SharePoint 2010 Server and you want to to delete some sites from the SharePoint 2007 instance. But when you try to go to "Site Actions > Site Settings" you face "Error , File Not Found"!!
and when you try the PowerShell normal commands, like stsadm -o -deletesite -url <url>  and delete-spsite -url <url> -identity <id> , it says  "Cannot find an SPSite object with Id or Url: xxxx "

You have to follow the right way to delete this sites:

1- Get the database name of the SharePoint 2007 instance: 
Go to the SharePoint 2010 Central Administration>Backup and Restore>Perform a Back Up , and get the database name under SharePoint 2007 web application

2- Get the WebID of the sites: 
In PowerShell use this command; stsadm -o enumallwebs -databasename <SP2007Database> > C:\Allwebs\Allwebs.xml , open the AllWebs.xml and find the url of the site you want to delete and get its ID from the same line.

3-Delete the site:
Use this command; stsadm -o deleteweb -force -webid <SiteID>  -databaseserver <DSName> -databasename <DBName>

Cheers,

Monday, March 17, 2014

Problem while starting a workflow in SharePoint 2013

Sometimes you found that the workflow is not starting, and when you check its status you find "Internal Status: Canceled"


Workflow Canceled










And when you click the blue mark, you will find:

 "System.ApplicationException: HTTP 401 {"Transfer-Encoding":["chunked"],"X-SharePointHealthScore":["0"],"SPClientServiceRequestDuration":["157"],"SPRequestGuid":["eda26c74-95ef-2733-fd4e-518b036ac92b"],"request-id":["eda26c74-95ef-2733-fd4e-518b036ac92b"],"X-FRAME-OPTIONS":["SAMEORIGIN"],"Cache-Control":["max-age=0, private"],"Server":["Microsoft-IIS\/8.0"],"WWW-Authenticate":["NTLM","Basic realm=\"Sharepoint.contoso.com\""],"X-AspNet-Version":["4.0.30319"],"X-Powered-By":["ASP.NET"],"MicrosoftSharePointTeamServices":["15.0.0.4420"],"X-Content-Type-Options":["nosniff"],"X-MS-InvokeApp":["1; RequireReadOnly"],"Date":["Mon, 17 Mar 2014 05:49:27 GMT"]} {"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to perform this action or access this resource."}}} at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)



notice that line: "Access denied. You do not have permission to perform this action or access this resource."

--> Before proceeding with solving the problem, make sure that the user initiating the workflow can browse the MySite normally.

then You can try:

  • Site actions > Site Settings > Site features
  • Activate site feature "Workflows can use app permissions"
Or:
  • Make sure that the "User Profile Synchronization Service" is Running.
  • Run a full synchronization in the User Profile Service Application.
Or:
  • Maybe it is a Permissions issue, make sure that the user initiating the workflow has "Edit" or "Contribute" Permission level on the site or the list, and that permission is granted Directly not through an AD group.

References: