SharePoint In Action

An attempt to share my day-to-day SharePoint experience

SharePoint 2013 database names

Hello,
I had too move my SharePoint 2013 databases to another SQL Server machine. In order to make it happen I had to detach, move and attach the following databases:

AppMng_Service_DB_<GUID>
Bdc_Service_DB_<GUID>
DefaultPowerPivotServiceApplicationDB_<GUID>
Managed Metadata Service_<GUID>
PerformancePoint Service Application _<GUID>
ProjectWebApp
Search_Service_Application_AnalyticsReportingStoreDB_<GUID>
Search_Service_Application_CrawlStoreDB_<GUID>
Search_Service_Application_DB_<GUID>
Search_Service_Application_LinkStoreDB_<GUID>
Secure_Store_Service_DB_<GUID>
StateService_<GUID>
SettingsServiceDB
SharePoint_AdminContent_<GUID>
SharePoint_Config
TranslationServices_<GUID>
User Profile Service Application_ProfileDB_<GUID>
User Profile Service Application_SocialDB_<GUID>
User Profile Service Application_SyncDB_<GUID>
WordAutomationServices_<GUID>
WSS_Content
WSS_Logging

Cheers,
Nader Heshmat

Advertisements

InfoPath 2013 – How to populate the logged-in user information using GetUserProfileByName

Hi,

Claim-based authentication has been chosen as the default authentication method for SharePoint 2013 and as result, I had a tough time getting the logged in user’s information in my InfoPath form using the familiar GetUserProfileByName web service method which I used to conveniently use in my InfoPath forms with SharePoint 2010.
The difference now is that the claim-based request adds a “0#.w|” in front of the user’s domain account. So my account would look like “0#.w|mydomain\naderheshmat” instead of “mydomain\naderheshmat” and this is what makes the web services methods break in InfoPath and you would get “Access Denied error” 😦

It turned out that I had to take following steps to make it work:

1- Create a new domain user account for your to be used for setting up the Secure Store Target Application. We call it “yourdomain\InfoPathUser”. This user should have at least read access to your site

2- Setup a Secure Store Target Application entry called something like InfoPathID. Make sure the target application type is Group and that you are using yourdomain\InfoPathUser and its password for windows user name and password fields. In my case my Target Application Members were all users.

3- Create a Data Connection Library in your site or use a already existing one as a place to keep .udcs files created in your InfoPath form.

4- Create a GetUserProfileByName secondary data connection in your InfoPath form (we call it GUP) and convert it to a connection file and use the address of your Data Connection Library for the place to save the .UDCX file

5- Go to your Data Connection Library and download the udcx file you just created. Open it and edit the XML tag to look like this:

<udc:Authentication>
              <udc:SSO AppId=’InfoPathID‘ CredentialType=’NTLM’ />
</udc:Authentication>

Note that we used the secure store application ID InfoPathID here.

6- Save the file and upload it back to the Data Connection Library.

7- In your InfoPath form create a rule called Rule1. For simplicity we create it as a Form Load rule. Under queryFields node of your data connection (GUP) set the “AccountName” to formula:
substring-after(userName(), “0#.w|”)  and then hit Verify Formula.

8- Create another rule called Rule2 and choose “Query for Data” using GUP.

You are all set. All you need to do is populating your fields the old fashion way. For more information for how to populate user’s info please take a look at:

http://sharepointisland.wordpress.com/tag/getuserprofilebyname/

Cheers,
Nader Heshmat

ValidateCredentialClaims – Access Denied: Claims stored in the credentials did not match with the group claim for a group app.

Hi,
Users were getting an error when they were trying to access the SharePoint site content. I checked the logs and found below errors:

ValidateCredentialClaims – Access Denied: Claims stored in the credentials did not match with the group claim for a group app.
Access is denied to the Secure Store Service.

In my case this was related to the members of my “Target Application” in my “Secure Store Service”. To fix it I went to Central Admin > Application Management > Manage Service Applications > Secure Store Service and edited the Target Application ID. I went to the third page by hitting Next.
I just added my members(or groups) to my target application’s member section.

BCS_Credentials

 

Thanks,
Nader Heshmat

SharePoint 2013 Workflow is not enabled in SharePoint Designer 2013

Hi,
I had created a Workflow Manager Farm but I was still unable to see the “SharePoint 2013 Workflow” in my SharePoint 2013 Designer.

WF_Install0

Here is what I did to make it work:

On my SharePoint server(s) I executed the PowerShell command below to register my workflow:

Syntax:

Register-SPWorkflowService –SPSite –WorkflowHostUri -ScopeName [-PartitionMode] [-AllowOAuthHttp] [-Force]

an example of abow syntax would be:

Register-SPWorkflowService –SPSite "http://my.sharepoint.com" –WorkflowHostUri "https://my.sharepoint.com:12290" –AllowOAuthHttp -force

or in my case since it was a dev box(no SSL):

Register-SPWorkflowService –SPSite "http://my.sharepoint.com" –WorkflowHostUri "<strong>http:</strong>//my.sharepoint.com:12290" –AllowOAuthHttp -force

Please note that the “Workflow Service EndPoint URL” can be found in your SharePoint Server’s IIS Manager:

WF_Install3

Please pay a close attention to the protocol your Workflow Service is using. By mistake I put http:// instead of https:// and I was getting error below:

Register-SPWorkflowService : The underlying connection was closed: An unexpected error occurred on a receive.

WF_Install2

After running the Powershell command you would need to go to your Central Admin and check the “Workflow Services Application” under “Manage Service Applications”. The Workflow Service Status should read “Workflow is connected”. Once the workflow is connected you should be able to see the “SharePoint 2013 Workflow” in your SharePoint Designer.

WF_Install5

WF_Install6

WF_Install4

Thanks,
Nader Heshmat

Uninstalling/Removing SharePoint 2013 Workflow Manager Farm

Hi,
These are the steps you would need to take to uninstall your Workflow manager 1.0:

For each node in your workflow farm:

  1. Leave the workflow farm (Remove the node from the farm using “Leave Workflow Manager Farm” option)

UninstallingWFM_0

 

 

UninstallingWFM_00

UninstallingWFM_1

     2.      Uninstall the following programs in the program list in the Control Panel window, under Programs select Uninstall a Program.

  • Service Bus 1.0
  • Windows Fabric
  • Workflow Manager 1.0
  • Workflow Manager 1.0 Client

UninstallingWFM_2

Once you are sure all nodes have left the workflow farm, you can delete below databases from you SharePoint SQL Server: (Backing them up beforehand might be a wise choice!)

  • SBMessageContainer01
  • SbGatewayDatabase
  • SBManagementDB
  • WFInstanceManagementDB
  • WFManagementDB
  • WFResourceManagementDB

UninstallingWFM_3

Cheers,
Nader

HTTP Error 503. The service is unavailable (when openning Central Admin)

SharePoint 503 Error

SharePoint 503 Error

Hi all,

I got this error when I was trying to open the central admin. It’s usually an issue with the IIS and application pool that has been stopped. Just make suer your application pools are running by going through the steps below:

1- Try to refresh the application pool, if it stops again try the following steps:

2- In Internet Information Services (IIS) Manager, locate your application pool account and right click on it and choose “Advanced Settings”
Under “Process Model”, find “Identity”
In “Application Pool Identity” window, under “Custom Account” hit the button “Set”
Enter the correct user name and password

If that didn’t help you would need to make sure your SP_Farm and SP_ServiceApps accounts have “Log on as a Batch Job” right in your “Local Policies”. To verify that you would need to:

3- Go to Administrative Tools –> Local Security Policy –> User Rights Assignmet and make sure there is a “Log on as a batch job” policy there

Cheers,
Nader Heshmat

Error: The Method “GetItems” of the type “List” with id “{Lists’s Guid}” is blocked by the administrator on the server

Hi all,

I was using SharePoint Client Object Model when I got the error above. Basically I was trying to get all items from a list using JavaScript’s get_lists function. It seems the function is inaccessible in anonymous mode. The solution is removing the function GetItems from AnonymousRestrictedTypes using PowerShell:

$web = Get-SPWebApplication -Identity http://your web address
$web.ClientCallableSettings.AnonymousRestrictedTypes.Remove( [Microsoft.SharePoint.SPList],"GetItems")
$web.Update()

and in case you change your mind later, you can addf GetItems to AnonymousRestrictedTypes using commands below:

$web = Get-SPWebApplication -Identity http://your web address
$web.ClientCallableSettings.AnonymousRestrictedTypes.Add( [Microsoft.SharePoint.SPList],"GetItems")
$web.Update()

Hope that was useful!

Cheers,
Nader Heshmat

Exporting all SharePoint Group Members Into A File

Hi,
Here is the SharePoint PowerShell script to get all group members for a SharePoint 2010 site and export it to a file:


$mySite = Get-SPSite “your sharepoint site url here”
$txtFile = “c:\groupmembers.txt”
foreach($grp in $mySite.RootWeb.SiteGroups)
{
    "`r`n`r`nGroup Name:” + $grp.Name | Out-File $txtFile -Append
    foreach ($usr in $grp.Users)
    {
          $usr.name + "," + $usr.UserLogin | Out-File $txtFile -Append
    }
} 

Cheers,
Nader Heshmat

Batch Updating The Items Of A SharePoint 2010 List

Hi all,

I created a web part for work last week to batch-update the items of a SharePoint 2010 list.
To make it simple I will show how to modify only one column in the whole list using CAML and you can simply expand the idea. My site is called “SampleSite” and the list is “SampleList”. We are modifying the column “SampleColumn”. Here is how the code looks like:

void UpdateList()
        {
            StringBuilder methodBuilder = new StringBuilder();
            string batch = string.Empty;
            string newValue="mmmm";
            string updateColumn = "SampleColumn";


            try
            {
                string batchFormat =    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                                        "<ows:Batch OnError=\"Continue\">{0}</ows:Batch>";
                string methodFormat = "<Method ID='{0}' >" +
                                        "<SetList>{1}</SetList>" +
                                        "<SetVar Name='Cmd'>Save</SetVar>" +
                                        "<SetVar Name='ID'>{2}</SetVar>" +
                                        "<SetVar Name='urn:schemas-microsoft-com:office:office#{3}'>{4}</SetVar>" +
                                        "</Method>";
                
                using (SPSite siteCol = new SPSite("SampleSite"))
                {
                    using (SPWeb web = siteCol.OpenWeb())
                    {

                        // Get the list containing the items to update
                        SPList list = web.Lists["SampleList"];
                        string listGuid = list.ID.ToString();
                        SPListItemCollection allItems = list.GetItems();

                        // Build the CAML update commands.
                        for (int i = 0; i < allItems.Count; i++)
                        {
                            int itemID = allItems[i].ID;
                            methodBuilder.AppendFormat(methodFormat, itemID, listGuid, itemID, updatedColumn, newValue);
                        }
                        web.AllowUnsafeUpdates = true;

                        // Generate the CAML
                        batch = string.Format(batchFormat, methodBuilder.ToString());

                        // Process the batch 
                        string batchReturn = web.ProcessBatchData(batch);
                       
                    }
                    //done
                }
 
            }
            catch (Exception ex)
            {
		//show the error
            }

        }
}

Note how the reference to the field has been made in the CAML command:

<SetVar Name='urn:schemas-microsoft-com:office:office#{3}'>{4}</SetVar>

Also note that you would need to set the web.AllowUnsafeUpdates to true.

Assuming SampleList has 4 items, your generated CAML should look like this:

<?xml version=\"1.0\" encoding=\"UTF-8\"?><ows:Batch OnError=\"Continue\">
	<Method ID='1' ><SetList>6deeec64-95f8-4e26-b5ad-e8770deaae5c</SetList><SetVar Name='Cmd'>Save</SetVar> <SetVar Name='ID'>1</SetVar><SetVar Name='urn:schemas-microsoft-com:office:office#SampleColumn'>mmmm</SetVar></Method>

<Method ID='2' ><SetList>6deeec64-95f8-4e26-b5ad-e8770deaae5c</SetList><SetVar Name='Cmd'>Save</SetVar> <SetVar Name='ID'>2</SetVar><SetVar Name='urn:schemas-microsoft-com:office:office#SampleColumn'>mmmm</SetVar></Method>

<Method ID='3' ><SetList>6deeec64-95f8-4e26-b5ad-e8770deaae5c</SetList><SetVar Name='Cmd'>Save</SetVar> <SetVar Name='ID'>3</SetVar><SetVar Name='urn:schemas-microsoft-com:office:office#SampleColumn'>mmmm</SetVar></Method>

<Method ID='4' ><SetList>6deeec64-95f8-4e26-b5ad-e8770deaae5c</SetList><SetVar Name='Cmd'>Save</SetVar> <SetVar Name='ID'>4</SetVar><SetVar Name='urn:schemas-microsoft-com:office:office#SampleColumn'>mmmm</SetVar></Method>
</ows:Batch>

Cheers,
Nader Heshmat

Error: The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.

Hi all,

I just got this error while developing a web part to batch update a SharePoint list. The solution was adding one line of code that allows running the update command on a list without requiring a security validation. This should be place right before your update command.

Consider the code snippet below:

SPSite siteCol = new SPSite(YourSiteURL);
SPWeb web = siteCol.OpenWeb();
SPList list = web.Lists[YourListName];
web.AllowUnsafeUpdates = true;

{your list update code goes here}

Warning:
Setting this property to true opens security risks, potentially introducing cross-site scripting vulnerabilities.

p.s. You can also use web.Site.WebApplication.FormDigestSettings.Enabled = false before your update and set it to true after

Cheers,
Nader Heshmat

Post Navigation