Friday 6 December 2013

A query to retrieve form data cannot be completed because this action would violate cross-domain restrictions. Infopath web service error

"A query to retrieve form data cannot be completed because this action would violate cross-domain restrictions. If this form template is published to a SharePoint document library, cross-domain access for user form templates must be enabled under InfoPath Forms Services in SharePoint Central Administration, and the data connection settings must be stored in a UDC file in a data connection library in the same site collection."

Recently I had come up with this issue when I try to use InfoPath form to submit data to a web service that hosted in my own server. And got the above error while opening the form. Finally I got the steps to resolve this.

Resolution Steps

1. Make sure that 'Allow user form templates to use authentication information contained in data connection files' in Central Admin is enabled

2.  Create a Data Connection Library in your site.

3. Convert the Data Connection to .udcx file as shown in the below picture


4. Give the path to data connection library


Publish the form to the SharePoint site.
Hope this helps...


Tuesday 3 December 2013

Calculated Column hyperlink to open an InfoPath Form

This is very tricky. Here I need to create a calculated column where I use a Hyperlink image on which, when the user clicks , InfoPath form shall open in browser.

First you simply set the data type of the Calculated Column from Text to Number or Date/time and it will display the link as a hyperlink. Copy and paste the below code and edit the url based on your site and library.

="<a href ='http://{SERVER}/{SITE}/{LIBRARY}/Forms/template.xsn?openin=browser'><img src ='http://{SERVER}/{SITE}/PublishingImages/Applynow.png'></img></a>"

Friday 29 November 2013

Rename the Add document link of a document library in sharepoint 2010

By using javascript function getelementbyid("idHomePageNewItem") we can change its display text to new text as we want

Open the document library in sharepoint designer. Open Alldocuments.aspx view in advanced mode.

Add the below script at the end of webpart zone
<script type ="text/javascript">
  document.getElementById("idHomePageNewItem-WPQ2").innerHTML="Enter your new text here"
</script>

Thursday 19 September 2013

How to check a list column value is null in calculated column

=IF(NOT(ISBLANK([Column1])), IF(NOT(ISBLANK([Column2])),
IF([Column1]<=[Column2], "Success", "Failure"),""), "")

“Open with Explorer” tab showing as disabled in sharepoint 2010

Sometimes you might faced below errors when you try to open the documents from library by clicking 'Open with Explorer' tab.

Typical error messages:
  • “Your client does not support opening this list with Windows Explorer.”
  • This is control is currently disabled as shown in below image
Resolution
Make sure that following service is started, by going: Click Start -> Control Panel -> Administrative Tools -> Services.  
Open the Properties of the WebClient Service. choose as start type: automatic . Restart the service . then check the site in IE

hope this helps...

Thursday 22 August 2013

Backup and restore the SharePoint 2010 content database to SharePoint 2013 farm

For migrating SharePoint 2010 to SharePoint 2013, content database migration is one of the step and it is easy to do.
 
SQL server DB backup from SharePoint 2010 farm

1. Select the database which you want to perform the backup of the database from SQL Server
2. Make sure the content database is read only. Right click the data base from properties change database read-only to true.

3. Right click on the content database and navigate to the tasks option and select the BACKUP.



4.The destination path will show by default with your content db name.bak
 If you want to provide the specific disk path, Click on Add button, enter your path
 
 

5. Select OK in the main Backup form to start the backup process. Once it is completed you will be receiving the completion message.
6. After back up change database read-only to False.
7. Go to Backup path which was provided during the backup process and rename to a user-friendly name
8. Move this file to SharePoint 2013 database server
Now you have to restore the database which you have taken into SharePoint 2013 .

Restore Databases in new SharePoint 2013 Farm environment:
1. Open the SQL server management studio and create a new database. Make sure you selected a db owner while creating a new database.
2. select the databases and select restore database.
 

3. Enter the newly database name in “Database” section below and Select “Device “option for providing the path as mentioned in the screenshot and click on the file browser button to provide the backup file path
4. Select the "Options" tab, check Overwrite the existing database(WITH REPLACE) check box.
5. Click OK to start the restore process..
 
Hope this helps...
 

Thursday 11 July 2013

sharepoint designer workflow email link to list

Most of the workflow end users requirement is, there should be a link to review the workflow item in  their email.
I am just sharing a quick tip to send an email to a sharepoint Item by adding hyperlink to the message body

1.       Add a “Send an Email” action to your workflow. Edit the action to pull up the email configuration dialog.
2.       Select the text and click the “Add hyperlink” button seen below.
When prompted for the address of the link click the string builder button to add the URL

  3.   In SharePoint, go to the form library where your InfoPath forms are stored, and click an existing  InfoPath form to open it in the browser.
  4.   Copy the URL of the InfoPath form. The URL could resemble the following:

http://ServerName/SiteName/_layouts/FormServer.aspx?XmlLocation=/SiteName/LibraryName/Form1.xml&Source=http%3A%2F%2FServerName%2FSiteName%2FLibraryName%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1
 
where ServerName is the name of the SharePoint server, SiteName is the name of the SharePoint site, LibraryName is the name of the SharePoint form library, and Form1.xml is the name of an InfoPath form 
Copy the URL and paste in the string builder window .Remove the shaded portion after
http://ServerName/SiteName/_layouts/FormServer.aspx?XmlLocation=
 
Instead of that add a lookup [%Current Item:Encoded absolute URL%]  as shown below

5. click OK and publish workflow

Now whenever you create a new InfoPath form and save it to the form library, the SharePoint Designer workflow is started, and an email is sent to the recipients you specified for the email in the SharePoint workflow. When a user opens the email and clicks on the link in the email, the InfoPath form opens in the browser.

Tuesday 2 July 2013

Nested IF Condition in Calculated Column

Assume that you have 3 approvers in a work flow and need to update the item status based on these approvers individual task outcome
1. Approver1_Status
2. Approver2_Status
3. Approver3_Status

You are updating a calculated column Status_Calc  based on approvers status.

And the scenario is if any approver rejects the request the item status need to set as Rejected and if the final approver approves, set item status as Approved

The [Status_Calc] value will be

=IF([Approver3_Status]="Approved","Approved",IF([Approver3_Status]="Rejected","Rejected",IF([Approver2_Status]="Rejected","Rejected",IF([Approver1_Status]="Rejected","Rejected"))))

Hope this helps...

Friday 15 March 2013

InfoPath 2010 At least one check box should be checked

Here is a simple solution for making one of the check box is checked before submitting the form

1. Create your checkbox fields (of data type true/false boolean)
2. Create a flag field and set default value to zero
3. Create a Submit Button
4. Create a message view
 
5. For each check box add 2 rules
6. Rule 1:  if checkBox1=true, Set flag = flag + 1


Rule 2: If checkBox1=False, set flag = flag - 1

 
7. On Submit Button Add 1 rule  If Flag=0, switch to message view



Hope This helps...


Sunday 10 March 2013

The Execute method of job definition Microsoft.SharePoint.Administration.SPSqmTimerJobDefinition threw an exception Event ID 6398

The Execute method of job definition Microsoft.SharePoint.Administration.SPSqmTimerJobDefinition (ID 9fb31cc3-1041-407c-bb02-4494e180b7c9) threw an exception. More information is included below.

Data is Null. This method or property cannot be called on Null values.

Resolution
Go to Central Admin - monitoring - review job definitions - job history (left) and change the view (right) to Failed jobs.You can see it is CEID Data Collection which is causing this problem. Click on Failed link
CEIP data collection job-  disable it...

Before doing this make sure the following things
1. In Central Administration, select System Settings
Click Configure privacy options under Farm Management
Under Customer Experience Improvement Program, select ‘No, I don’t wish to participate
Next this needs to be disabled for all web applications, including Central Administration.

2. Select Application Management, then Manage Web Applications
Select the first Web Application in the list and click General Settings
At the very bottom of list, select No in the Enable Customer Experience Improvement Program
Repeat for all Web Applications in the farm.

Friday 8 March 2013

How to get list of all users in a site collection

In your url just append _layouts/people.aspx?MembershipGroupId=0. This will give you all users from all groups in a site collection.

If Url is http://localhost:9000/default.aspx, try with 
 http://localhost:9000/_layouts/people.aspx?MembershipGroupId=0

Now,If you want to delete a user from site collection, there is remove option in the breadcrumb menu

How to get list of names of webparts on a page

In your url just append contents=1. This will give you all the web parts that are deployed.

For example: if Url is http://localhost:9000/default.aspx, try with http://localhost:9000?contents=1

Now, If any web part makes errors on your page, you can disable/remove from this page



Thursday 7 March 2013

"Related Content" link in work flow Task form does not open in browser

Below is the step by step procedure for solving the issue

1.Open C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\template\layouts.
2. Locate the WrkTaskIP.aspx.  Make a copy of the file and Open in sharepoint designer.
3.  Locate the line SPHttpUtility.NoEncode(m_pageDescription,Response.Output); remove this and add below code 
<%
if(m_pageDescription.Contains(".xml"))
{
//Forcing any xml items to open with forms services
SPHttpUtility.NoEncode(m_pageDescription.Replace("http",SPContext.Current.Web.Url+"/_layouts/FormServer.aspx?DefaultItemOpen=1&ClientInstalled=true&Options=DisableSave&XmlLocation=http"),Response.Output);
}
else

SPHttpUtility.NoEncode(m_pageDescription,Response.Output);
}
%>
4. Do save

 hope this helps..

Application Server Administration job failed for service instance. Event ID 6482

There were many issues that require you to clear the share point configuration cache on your servers.

Below is the step by step provided by Microsoft for Clearing Configuration Cache
1. Stop the Windows SharePoint Services Timer service (Found in Windows Services)
2. Navigate to the cache folder
Drive:\ProgramData\Microsoft\SharePoint\Config\<GUID>
There may be more than one  GUID folders
3. Locate the folder that has the file "Cache.ini"
4. Back up the Cache.ini file.
5. Delete all the XML configuration files in the GUID folder
Note : make sure that you do not delete the GUID folder and the Cache.ini file that is located in the GUID folder.
6. Open Cache.ini file in Note Pad, click Select All and Delete. Type 1, and then Save. Close the Note Pad.
7. Start the Windows SharePoint Services Timer service
8. Restart IIS
Make sure that the Cache.ini file in the GUID folder now contains its previous value, not 1.

Resolving the super user/super reader account utilized by the cache is not configured


By default, the Portal Super User account is the site’s System Account, and the Portal Super Reader account is NT Authority\Local Service.

Give domain\superuser, Full control in user policy of the particular site from Central administration. And also for domain\superreader Full read permission in user policy.

If your web application is using claims based authentication the users should be displayed like i:0#.w|domain\superuser and i:0#w|domain\superreader.

To add the user accounts to the Web application by using Windows PowerShell
Verify that you meet the following minimum requirements: See Add-SPShellAdmin.
Copy the following code and paste it into a text editor, such as Notepad:

$wa = Get-SPWebApplication -Identity "http://<server>/"
$wa.Properties["portalsuperuseraccount"] = "i:0#.w|domain\superuser"
$wa.Properties["portalsuperreaderaccount"] = "i:0#w|domain\superreader"
$wa.Update()


Save the file, naming it SetUsers.ps1. Close the text editor.

On the Start menu,Open SharePoint 2010 Management Shell. Change to the directory where you saved the file.At the Windows PowerShell command prompt, type the following command: ./SetUsers.ps1

After you've run these PowerShell cmdlets  perform an IISRESET to finish it off.

Limiting People Picker to a certain OU in Active Directory

If a Web application is using Windows authentication and the site user directory path is not set, the People Picker control searches the entire Active Directory to resolve users' names or find users, instead of searching only users within a particular organizational unit (OU). The Stsadm setsiteuseraccountdirectorypath operation allows the user's directory path to be set to a specific OU in the same domain. After the directory path is set to a site collection, the People Picker control will only search under that particular OU.
To restrict People Picker to a certain OU in Active Directory, type the following command:

stsadm -o setsiteuseraccountdirectorypath -path <Valid OU name> –url <Web application URL>

The following example configures People Picker to only return users and groups in the OU named "Sales":
stsadm -o setsiteuseraccountdirectorypath -path "OU=Sales,DC=ContosoCorp,DC=local" –url http://ServerName

Only a single site user directory path can be set at a time for a site collection. Because this property specifies only one OU at a time, you should run the Stsadm setsiteuseraccountdirectorypath operation only once per site collection.

To retrieve the current user account directory path for the site, use the following syntax:
stsadm -o getsiteuseraccountdirectorypath -url <Web application URL>

Work Flow is not updated. Showing as cancelled in work flow column

Sometimes this situation may happen, you are making changes to your SPD workflow and they are not reflected on the list/doc library where the workflow is deployed.

reason is that, SPD will use the cahced information from a location such as the following:

%System Drive%\%user%\Local\AppData\Microsoft\WebSiteCache

Here you will find a folder named similar to your SharePoint site on which you are working.

Delete this folder and restart SharePoint Designer and IIS. Make any changes to your workflow and that should be reflected onto your list/library.

Thursday 28 February 2013

Taking Backup and restore sharepoint in command line

Taking site backup and restoring using STSADM is probably the easiest and fastest one.
Backup the site using the following STSADM Command:

stsadm -o backup -url http://mysite/ -filename backup-filename.bak

Create a new Web Application for restoring the site:Go to Central Administration -> Application Management -> under SharePoint Web Application Management -> click Create or Extend Web Application. Fill in the required information, click Ok and wait until the progress continues.

Once the new web application is created, run the following STSADM command and restore the site using the backup file created above.

stsadm -o restore -url http://myothersite/ -filename backup-filename.bak

For some reason we needed to create an empty web application and a site collection first, and restore on top of that using the -overwrite option of stsadm.exe,

This backup/restore command can only used for site collection back up/restore.
If it is a single site, export/import command is using instead of backup/restore

Difference B/W Sequential Workflow and State Machine Workflow

Sequential Workflow:
- It looks very simple like flow chart.
- Steps within the workflow execute sequentially, one after another in the particular order.
- A sequential workflow always progresses forward, never going back to a previous step.
- Sequential workflows are definitely much easier to design and maintain.

State machine Workflow:
- A state machine workflow executes in no particular order and these are based on events like OnTaskCreated, OnTaskDeleted etc.
- A state machine workflow moves from one state to another until the logic concludes the workflow has completed.
- Compared to Sequential workflows State machine workflows are difficult to design and maintain.
- In order to move to another event, the workflow needs to meet another state.
- The workflow doesn’t really have to end. It can stay in the same state for weeks.
Visual studio provides both Sequential workflow and State Machine workflow. But in SharePoint designer you can only make sequential workflows.

There are some business process that requires a state machine workflow like for example: a bug tracking system where When the workflow first starts, the bug may be placed in a Pending state, where it waits for a developer to be assigned and start working on the bug. When the developer starts working on the bug and fixes it, the bug is put into a Fixed state. When the bug is fixed, a tester confirms the resolution of the bug. If it is not fixed, he places the bug back in a Pending state.
So you should decide the type before developing the workflow. Because it will be very difficult to change once you have started that workflow.

Sequential workflow should used when there is only one way to complete a task and the workflow controls the process. But state machine workflow can stay in a same step for a longer period of time, must not be in an end state. State machine does not have any specified path, they are event driven.