Tuesday, December 18, 2012

Controls on the InfoPath Task Edit Form Not Persisting Values

The SharePoint 2010 Visual Studio workflow uses an InfoPath form as the task edit form. On the form, values of some of the controls are persisted once the task edit form is submitted, but values of some other ones are not. For instance, input a value into a textbox then submit the task edit form, then open the task edit form again, the textbox is empty, the inputted value is gone.

It turns out that the problem is caused by the column name of the task list of the workflow. Let's say there is a textbox on the InfoPath task edit form, the textbox is bound to ClientName field and default value for ClientName field is ows_ClientName via the ItemMetadata.xml file. If the workflow task list has a column named ClientName, then the value of the textbox is not persisted. For unknown reason, the workflow engine can't process ExtendedProperties["ClientName"] correctly.

Solution: The column name of the workflow task list should not be the same name from ItemMetadata.xml file, without the ows_ prefix, if the value of the control bound to the entry in ItemMetadata.xml file needs to be persisted.

How to retrieve a reference to the SearchServiceApplicationProxy

Excerpt from this page:

I think the new best practice will be to pass a reference to the SearchServiceApplicationProxy.  The trick of course is getting that reference.  First, you need to determine the name of your Search Service Application.  For a typical Enterprise Search installation it is called Search Service Application.  However, it can be called anything depending on how you configured SharePoint.  For FAST, it might be called something like FAST Content SSA.  Go to Central Administration –> Service Applications and take a look.
The proxy will usually have the same name as the Service Application, so in my case here the name of my proxy is Search Service Application.  Now we just can’t get a reference to the SearchServiceApplicationProxy directly.  We have to go through the SearchQueryAndSiteSettingsServiceProxy class first.  According to the SDK, the function of going through this service is to ensure queries are load balanced.  Here is how you get a reference to the query and settings proxy.  It also assumes this code is executing on one of the servers in the farm.
SearchQueryAndSiteSettingsServiceProxy settingsProxy = SPFarm.Local.ServiceProxies.GetValue<SearchQueryAndSiteSettingsServiceProxy>();
Now that we have a reference to the settings proxy, we can get a reference to the SearchServiceApplicationProxy with the name of the proxy that we saw above.  Change the name to match whatever yours is called.
SearchServiceApplicationProxy searchProxy = settingsProxy.ApplicationProxies.GetValue<SearchServiceApplicationProxy>("Search Service Application");

Now you can pass this proxy to the constructor of the KeywordQuery or FullTextSqlQuery.

Monday, December 10, 2012

Best Practices to Change App Pool Account for SharePoint Web Application

Basically, you should make the change via Central Admin/Security/Configure service accounts. After you make the change on that page (Credential Management), you need to do "iisreset /noforce" on all SharePoint servers.

SharePoint makes lots of changes behind the scene after you make the change on the Credential Management page. This link gives a very good rundown.

Thursday, November 29, 2012

SharePoint Kings: How to make My group task webpart from My task

To display the tasks assigned to the groups that the user belongs to.

 1. Add content query web part on the page.
2. Edit that web part. In Query section select Source as task list (you can browse and select task list)
3. Set Additional Filter with “Assigned To” --> “is equal to” --> [Me]
4. Apply it

Now if you see that web part must looks like normal task web part.

Now export that web part.

Save it on your pc.

It should have .webpart extension.

Open it with notepad(or any editor)

Find QueryOverride property. (it must be blank) like this <property name="QueryOverride" type="string" /> now add below query inside <property name="QueryOverride" type="string" ></property> here is the query <Or> <Eq> <FieldRef Name="AssignedTo"/><Value Type="Integer"><UserID/></Value> </Eq> <Membership Type="CurrentUserGroups"><FieldRef Name="AssignedTo"/></Membership> </Or>

SharePoint Kings: How to make My group task webpart from My task: Hi, We all are using my task web part (superb out of the box web part) but most of the time we are having requirement where a task is ass...

Wednesday, November 14, 2012

Reset FAST Search Server for SharePoint (FS4SP) Index

First, need to reset the index in Central Administration / Application Management / Manage Service Applications, then click your FAST Search content SSA, then click Index Reset.

We are not done yet, we also need to manually clear the content from the content collection that our FAST Search Content Search Service Application feeds to. The default collection name is sp.

To clear a FAST Search Server 2010 for SharePoint content collection, log onto the server that hosts FAST Search Server 2010 for SharePoint and follow this procedure.

Clear the content collection

  1. Verify that you meet the following minimum requirements: You are a member of the FASTSearchAdministrators local group on the computer where FAST Search Server 2010 for SharePoint is installed.
  2. On the Start menu, click All Programs.
  3. Click Microsoft FAST Search Server 2010 for SharePoint.
  4. Click the Microsoft FAST Search Server 2010 for SharePoint shell.
  5. At the Microsoft FAST Search Server 2010 for SharePoint shell command prompt, type the following command:
    Clear-FASTSearchContentCollection -Name
    • is the content collection you are about to clear.
  6. Wait for the command to finish. This may take some time.

    After all of above is finished, then we can start new crawls.

Tuesday, November 13, 2012

SharePoint List View Filter Order of Precedence

This blog post explains the order of precedence of list view filters, with good example.

Here are the basic rules I copied from above post:

1. All logical operations occur from top to bottom.
2. Earlier logical operations are nested within later logical operations.

Wednesday, November 7, 2012

SharePoint 2010 Stretched Farm

Very good information.
Killing two birds with one stone: SharePoint HA and DR with stretch farm, and everything you want to know about it

Setting-up SharePoint 2010 stretched farm

It looks like that SharePoint 2013 does not support stretched farm, see http://technet.microsoft.com/en-us/library/cc262485%28v=office.15%29.aspx#hwLocServers
All servers that belong to a server farm, including database servers, must physically reside in the same datacenter. Redundancy and failover between closely located data centers that are configured as a single farm ("stretched farm”) is not supported in SharePoint 2013. 

But as this the comments from this blog shows, it depends and it is often case by case.



Tuesday, November 6, 2012

Using the Row ID value in a calculated column quirk

Sharepoint has a quirk where it drops the [ ] around ID in the calculated value. This happens when either a new item is added to the list or I edit an existing item. The short-term fix is that every time a change is made, I have to manually go enter the brackets back around  ID but it’s hard to keep up with. Long-term fix is to use SharePoint Designer workflow.

Please see detail here.

Wednesday, October 24, 2012

How to print a single list item in SharePoint 2010

The following is copied from

Derek Halstead's SharePoint 2007/2010 Blog

  1. Open a List
  2. Hit the List tab
  3. Click the Form Web Parts dropdownlist
  4. Choose “Default Display Form”
  5. At the top of the Page – Insert Tab, Click the Web Part button to add a new Content Editor web part (CEWP).
  6. From Categories choose “Media and Content” > “Content Editor” and add it to the main section of the page.
  7. Click the “Click here to add content” and then click the HTML button in the Ribbon to bring up the Edit source code window.
  8. In the window add the following code to display a Print Button at the top of the list item window.

<input onclick="window.print();return false;" type="button" value=" Print this page " />

  • Ignore any warnings.

  • Next, hit the Page tab at the top of the page to view the List item. You should see the Print button.

  • Hit the Print button to print just the list item.


    Friday, October 12, 2012

    Update-SPSolution limitations

    According to TechNet, The Update-SPSolution cmdlet upgrades a deployed SharePoint solution in the farm. Use this cmdlet only if a new solution contains the same set of files and features as the deployed solution. If files and features are different, the solution must be retracted and redeployed by using the Uninstall-SPSolution and Install-SPSolution cmdlets, respectively.

    How to rename the automatically generated task form in SharePoint Designer workflow

    In SharePoint Designer click on All Files in the Site Objects. In the All Files tab navigate to Workflows and click on your workflow. You should see the xoml file, the rules file, the xsn forms and a wfconfig xml file.

    To rename the xsn form, update the wfconfig xml file. Replace the old name with the new one. That xml file contains the content type related to that task, so you can also change the contenttype name as the 'WorkflowForm' name. After saving the wfconfig xml file you need to restart SharePoint designer and you should see your form with the new name.

    You need to be the site administrator in order to see the All Files link un Site Objects. 

    Also it looks like that Lookup type does not work in Task Form Fields, i.e., you can't have lookup type field in task form. If you do, you may see "SharePoint Designer encountered an error generating the task form" error message.

    Thursday, October 11, 2012

    SharePoint Designer Workflows Process Identity

    When a SharePoint Designer (SPD) workflow runs, it runs in the context of the workflow initiator. This is important to know if the initiator may not have permissions to everything that the workflow does.

    See SharePoint Designer Workflows – what user identity?

    SharePoint Designer 2010 introduces the new impersonation step. Please note that the impersonation step can be run only as the user who authors the workflow. The author of the workflow, most likely, is not the same as the identity of the SharePoint timer job. 

    Friday, September 28, 2012

    SharePoint 2010 boundaries, thresholds and supported limits

    From Jeremy Taylor's Blog:


    Thursday, August 30, 2012

    Disable SharePoint 2010 "I like it" "Tags & Notes" Social Feature

    You can enable/disable social tagging feature for specific users or groups by removing them from the Use Social Features permission, which is part of the User Profile service | Manage User Permissions.

    If you want the the I Like It and Tags & Notes UI controls to disappear, then you need to disable the SocialRibbonControl (Social Tags and Note Board Ribbon Controls)
    feature. You can enable/disable this feature by going to CA->System Settings->Manage farm features under Farm Management heading. Please note the scope of the feature is at the farm level.

    For detail, see http://technet. microsoft. com/en-us/ library/ee721064 .aspx

    Tuesday, August 28, 2012

    Learning about nctrl, and disabling the FAST Search Web crawler

    From Marcus Johnson - http://blog.comperiosearch.com/2011/07/learning-about-nctrl-disabling-fast-search-web-crawler/

    It looks to me that stopping the web crawler stops the in progress crawling too.

    Tuesday, July 24, 2012

    Network Error When Using Open with Windows Explorer on a Folder of a SharePoint Document Library

    Got error message: Windows cannot access "the path", You do not have permission to access "the path". Contact your network administrator to request access.

    Here is how I trouble shoot the problem:

    For me, the problem happens only on one particular SharePoint document library folder, and the problem applies to multiple client workstations too, so the problem is not caused by a particular workstation.

    And all users accessing the folder using Windows Explorer run into the same problem too.

    Checked SharePoint permissions and it is not an issue. 

    I also tried the solution from http://support.microsoft.com/kb/912152/, but no help.

    Also copied the folder, using Powershell Export-SPWeb and Import-SPWeb into a different SharePoint site and the problem persists too.

    After copied all the files to brand new folder, using Powershell, the problem is still there. This tells me that the problem is not related to the folder, but is caused by one or more files in the folder.

    Eventually I identified the file which causes the pain. There is carriage return and/or line feed in the file name. After I copied the file name to Notepad then copied the text from Notepad back to SharePoint, the problem is gone.

    A good reference on File Name, Length, Size and Invalid Character Restrictions and Recommendations

    Friday, July 13, 2012

    Get-FASTSearchContentCollection Error Message

    When execute Get-FASTSearchContentCollection -Name "sp"
    Get the following error message: Get-FASTSearchContentCollection : Failed to communicate with the WCF service.

    I was running the PowerShell window as administrator. However I need to run the PowerShell window with FAST user account. To access "Run as different user", hold down the Shift key while right - click the "Microsoft FAST Search Server 2010 for SharePoint".

    Thanks to Corey Roth for the solution!

    Modify Names of FAST Search Service Applications Databases

    Modify Names of FAST Search Service Applications Databases

    Using PowerShell to automate FAST Installation and Configuration:

    Configuring FAST for SharePoint 2010 Using PowerShell

    Thursday, June 14, 2012

    SharePoint 2010 Location Based Views (Per-Location View)

    In SharePoint 2007, location based views (different views for different folders) can be achieved by using content types, such as creating sub content types from the folder content type.

    SharePoint 2010 makes location based views a lot easier. Once the Metadata Navigation and Filtering feature (site feature instead of site collection feature) is enabled at the Site Actions -> Site Settings -> Manage site features under Site Actions heading,  the Per-location view settings is available for use under the General Settings heading of the settings page of document library and list. Per-location View Settings page allows you to configure available views for specific folder, content type, managed metadata, etc.

    Tuesday, May 29, 2012

    SharePoint Solution Deployment Stuck at Deploying Status

    While trying to upgrade a SharePoint 2010 solution using the following command, received the error message saying "A deployment or retraction is already underway for the solution blah, and only one deployment or retraction at a time is supported".

     update-spsolution -identity blah.wsp -literalpath "blah" -gacdeployment

     The status also shows "Deploying" at Central Administration / System Settings / Manage farm solutions under Farm Management section.

    The fix: Go to Central Administration / Monitoring / Check job status under Timer Jobs, Under Running section, locate the entry for the solution deployment job, the job should be named as "Microsoft SharePoint Foundation Solution Deployment for %SolutionName.wsp%. Click on the job title, then click the Delete button to delete the job on the next page. Afterwards, you can try to deploy the solution again.

    The old stsadm comand, for example, see below, does not work anymore.
    stsadm -o canceldeployment -id "job guid"

    The "job guid" can be retrieved by issuing the following command:
    stsadm -o enumdeployments

    Monday, May 14, 2012

    SharePoint Configuration Database Too Big

    Ever wondering why is the SharePoint configuration database so large?  The database is over 35 GB and its transaction log file grows up to 90 GB. There are potentially 2 issues.
    1. the log file is too big: the log file can be shrank easily by using Management Studio, for example. Setting the database to simple mode can help too, but evaluate the pros and cons before making the change.
    2. the database is still too big after shrinking the log file. After some research, I found out that there is a TimerJobHistory table in the configuration database and this table uses huge amount of space. There is a job "Delete jobs history" under Central Administration->Monitoring->Timer Jobs, which runs weekly by default, and that job is supposed to delete old entries from the timer job history table. In my situation, the table has entries more than one month old and default number of days to keep is 7, I believe. The timer job is enabled and there is no error messages. So what happened?
    Long story short, the timer job runs weekly as expected, but it fails because during the execution, the transaction log runs out of space. To fix the problem, I need to reduce the amount of data being deleted by the timer job during each run, so I need to modify the daystokeephistory value of the timer job. However, there is no UI to modify the retention days, the only way is to use PowerShell. See below:
    $test = Get-SPTimerJob | Where-Object {$_.name -eq "job-delete-job-history"}
    Above would display the current value.You can set the proper value for daystokeephistory then use either Central Administration or Power Shell to kick off the timer job, see below.
    $test.daystokeephistory = 25
    After multiple runs, at the end I set the timer job schedule to daily and daystokeephistory to 2 days.

    So far so good.

    Tuesday, May 8, 2012

    List form can't be edited by InfoPath if the list has managed metadata column

    Many people may have known about this already.

    The exact error message from InfoPath is: The following fields in the SharePoint list are not supported because of their data type and will not be available in InfoPath Designer

    Friday, May 4, 2012

    Provision the Web Analytics Service Application on Microsoft SharePoint Server 2010

    Good information from Bill Baer's Blog:


    Also usage reporting functionality is not available in SharePoint Designer 2010. SharePoint Designer 2007 has the reporting functionality.

    After  Web Analytics Service Application is provisioned, users with proper permissions can go to Site Actions/Site Settings page to view usage reports. The reports are under Site Actions heading.

    Thursday, March 29, 2012

    Change SharePoint Designer Workflow task list

    When creating a SharePoint Designer 2007 workflow, the workflow uses the first task list available, based on the name of the task list, sorted alphabetically.

    2 ways to use a specific task list for your workflow:
    •   create a new task list with a name which makes the new task list the "first" task list available. After the workflow is associated with this new task list, then you can go ahead rename the task list to your liking.
    • modify the *.wfconfig.xml in SharePoint Designer. Specifically, change the TaskListID to the tasklist id of the task list you want the workflow to use.

    Wednesday, March 28, 2012

    SetState activity fails using one of the predefined SPWorkflowStatus enumeration values

    Get the following error message: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.     at Microsoft.SharePoint.Workflow.SPWorkflow.SetIStatus(Int32 i, Int32 iStatus)

    Workaround: use custom values, see below:


    Friday, March 23, 2012

    SharePoint 2010 can't open xlsx file in the browser

    Received message "Unable to process the request. Wait a few minutes and try performing this operation again".

    1. Ensure that Excel Service Application is created and running under "Manage service applications"
    2. Ensure that Under "Manage services on server", the Excel Calculation Services is started and running on the web front end(s) of the farm
    3. Ensure that the Excel Service Application is associated with the proper web applications under "Configure service application associations"

    Update: Excel file can't be edited in browser without Office Web Apps. 

    Thursday, March 22, 2012

    How to change the namespace of safecontrol entry for a visual webpart

    Here it is: basically you need to make the change in SharePointProjectItem.spdata which is located at the same folder as your webpart code.

    I found the solution from this blog: http://pholpar.wordpress.com/2010/03/10/changing-the-namespace-of-the-web-part-in-a-visual-web-part-project/

    Wednesday, March 21, 2012

    SharePoint 2010: Clicking the icon in Type column is highlighting the item instead of launching the document


    In a list view of a document library in SharePoint 2010, when the document icon for an item in the Type column is clicked, the document is not offered for opening. Instead, the row for the item is selected. This behavior is different from SharePoint 2007 where clicking on the document icon opens the document itself.

    Fix: http://support.microsoft.com/default.aspx?scid=kb;en-US;2457975

    Tuesday, March 20, 2012

    How to remove "Edit in sharePoint Designer" from Site Actions menu

    Suggested by this thread: http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/46c9b89b-bec8-4335-9096-d7bf7a8114f4/

    Hide Edit in SharePoint Designer:
    • In Central Administration you can disable SharePoint Designer at the Web application level - Manage Web Applications > Select your web app > In the ribbon click on the General Settings Dropdown > Select SharePoint Designer. When the settings page appears, deselect the "Enable SharePoint Designer" checkbox then click OK. You'll obviously need Central Admin access to use this method.
    • At the site collection level, in Site Collections Administration section of "Site Actions > Site Settings" at the site root, click on the "SharePoint Designer Settings" link. Same options as Central Admin appear - Uncheck the "Enable SharePoint Designer" checkbox then click Ok. You'll need to be a Site Collection Administrator to use this method.
    • Note - Site Collection administrators will always be able to edit in SharePoint Designer 

    Above does not work, after I made above suggested changed in CA, the option is still available. However, the capability of editing in SharePoint Designer is disabled.

    Upload Multiple Documents Option in SharePoint 2010 is missing

    This will occur if a client machine is using 64bit Internet Explorer per the following thread:


    Wednesday, March 14, 2012

    Slow SharePoint (MOSS 2007) Windows Explorer View using Windows 7 and Internet Explorer 8 (IE8)

    Here is the fix:

    1. In IE8, go to Tools > Internet Options
    2. Click the Connections tab, then the LAN Settings button
    3. If Automatically detect settings is checked, uncheck it
    4. Reboot
    This solution is original posted by Blind Hole.

    Wednesday, February 29, 2012

    SharePoint 2007 Crawl / Index extremely slow

    If a list does not have a default view, it can cause severe indexing / crawling problem.

    Please see: crawl taking indefinitely to complete

    Another good post about SharePoint 2007 crawling and how to improve indexing performance:
    moss 2007 long running search crawls

    Tuesday, February 28, 2012

    stsadm import error: Exception from HRESULT: 0x80040E14

    Progress: Importing List Project Document Library.
    [2/27/2012 3:55:14 PM]: FatalError: Exception from HRESULT: 0x80040E14
       at Microsoft.SharePoint.Library.SPRequest.CreateListOnImport(String bstrUrl, Guid& pguidListId, String bstrTitle, String bstrDescription, Int32 lTemplateID, String bstrFeatureId, Guid guidRootFolderId, Int64 llFlags, Int32 iVersion, Int32 iAuthor, String bstrFields, String bstrContentTypes, String bstrImageUrl, String bstrEventSinkAssembly, String bstrEventSinkClass, String bstrEventSinkData, Guid guidDocTemplateId, String bstrViews, String bstrForms, Boolean bCompressedSchema)
       at Microsoft.SharePoint.Deployment.ListSerializer.CreateList(SPWeb parentWeb, Dictionary`2 listMetaData, Boolean usingPublicSchema)
       at Microsoft.SharePoint.Deployment.ListSerializer.SetObjectData(Object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
       at Microsoft.SharePoint.Deployment.XmlFormatter.ParseObject(Type objectType, Boolean isChildObject)
       at Microsoft.SharePoint.Deployment.XmlFormatter.DeserializeObject(Type objectType, Boolean isChildObject, DeploymentObject envelope)
       at Microsoft.SharePoint.Deployment.XmlFormatter.Deserialize(Stream serializationStream)
       at Microsoft.SharePoint.Deployment.ObjectSerializer.Deserialize(Stream serializationStream)
       at Microsoft.SharePoint.Deployment.ImportObjectManager.ProcessObject(XmlReader xmlReader)
       at Microsoft.SharePoint.Deployment.SPImport.DeserializeObjects()
       at Microsoft.SharePoint.Deployment.SPImport.Run()

    Problem: the document library (Project Document) has way too many views. After most of the views are deleted, then stsadm import worked fine (do an export again, of course). However, I don't know what the maximum number of views a document library can have without causing import error.

    Also make sure that there is no space issue.