Showing posts from 2013

Adding the List Data to a Task Form in InfoPath 2010

Viewing Initiation Lists Data as a Secondary Data connection on a Task Form using InfoPath 2010 in SharePoint 2010Building business processes in SharePoint usually requires assigning tasks at stages for users to approve, enter data, or move the process along somehow.Problem: Assigning a task to someone creates another object, separate from the original list or document library, which can confuse users.Solution: View external data, like the list that fired the workflow, inside the form that is created for a task.  This is accomplished in InfoPath 2010. Environment: SharePoint Server 2010InfoPath 2010SharePoint Designer 2010Ensure that Workflow Features are Enabled in your site Walkthrough: This is an example of how to accomplish this.  I am keeping this simple as you can adjust this later for your needs.

Use a list in SharePoint 2010.  If you need to create a custom list in a test area and populate it with some fields.  We are only going to be using Title and ID in this example, again si…

Disable Loopback Check

The Infamous Disable Loopback Check and SharePoint Windows Server 2003 and newer implemented a security fix to disable browsing sites from within a server that do not match its hostname or the loopback address.  This is detailed here by a great SharePoint man, Spencer Harbar:

At my current location I have setup multiple site collections on multiple web applications.  I also have multiple web applications using host headers and SSL-only with a wildcard certificate.  This would traditionally be a problem if I need to share data among them (and I do).  Thankfully we use Kerberos and I have Kerberized all of my web applications and we are using Classic authentication with integrated windows authentication.  So happily I go to SharePoint Designer to create a SOAP data source to connect to the web service on another web application or site collection, choose Windows …

SharePoint 2010 Search Tuning

My research and thoughts on tuning the SharePoint Server 2010 Search system Recently I used best practices guidance to rebuild the indexes with padding on my SharePoint 2010 SQL Server for all user databases.  This included the search databases: Search, Property, and Crawl.  I ran into a serious issue with search after I did this. Lesson 1: Some of the indexes on the Crawl Database require Ignore Duplicates to be ON. If you rebuild indexes uses the management studio or improperly set the attributes after rebuilding, the Ignore Duplicates will be set to OFF and your search indexer will run forever with errors that are stuck trying to insert duplicate key value pairs into certain indexes.
Learn to manage your content sources and monitor the impact, performance, and health of your search farm. Lesson 2: Split up separate web applications and file shares as individual content sources in the search application. Before you begin multiplexing and load balancing your search system with multipl…

Tuning SQL Server for SharePoint

SharePoint is highly dependent on SQL Server.  For optimal performance and in fact even to use SQL at all, there are some settings that are required and some that are suggested. CollationSharePoint databases require Latin1_General_CI_AS_KS_WS.  It will not let you create a database if the collation is otherwise.Your best bet is to use a separate instance of SQL for SharePoint and set the server default configuration to this collation during install (the only time you can set the server default).If you do not have this collation set, just make sure to set this collation when you create a new blank database for use with SharePoint.InstanceIt is recommended to create a separate instance of SQL for SharePoint and not to share other applications with this database.DisksRAID 10Use this setting for all SQL server disk arrays on a production farm.This could be modified slightly if using Solid State (i.e. using a pair of SSD drives in RAID 1 for tempdb may be sufficient versus cost of th…

SharePoint Designer Workflow Date Strings

Recently I needed to create a custom column identifier using the ID field.  I would normally use a calculated field to do this, but calculated fields do not work with the ID field, because the ID field is not updated until after the item is created, so there is a timing issue.  If we use a Designer workflow to fire when a new item is created, we can use the ID field because the workflow runs after the item created event.
Calculated Field The calculated filed can easily pull the year our of the Created date/time.

But if we include the ID column, the ID portion will remain blank or at least not consistently work correctly.
Designer Workflow
Create a Local VariableName: ISODateType: StringCreate a local VariableName: DateYearType: StringCreate a stepTitle: Get YearAdd ActionSet Workflow VariableSet: Variable: ISODate to Current Item:Created (Make sure Return Field as: …

Fixed Width SharePoint

Fixed-Width SharePoint 2010 Master Page with Centered Content I have been working on a project to create a sharepoint site collection that looks like Adobe Labs, for announcing and displaying software products under development across the company.
CSS CSS is the key here, the following will create the fixed width, centered, with scrollbars: html{background-color:#444444;overflow/**/:auto;}
body.v4master {width:950px;margin:0px auto;overflow:visible;background-color: transparent !important;}
.ms-dialog body.v4master {height: 100%;overflow: hidden;width: 100%;} body #s4-workspace {left: 0;overflow: auto !important;overflow/**/: visible !important;position: relative;width: 100% !important;display:table;border-spacing:0px;}
.ms-dialog body #s4-workspace{display:block !important;overflow/**/: auto !important;}
CSS for the welcome text: .WelcomeArea {padding-top:6px;} .WelcomeText {color:#FFFFFF;font-size:11px;float:right;}
CSS for the navigation and ribbon: /* Aligns the Top Bars */ .ms-c…

Connect SharePoint 2010 Search to File Shares

Use SharePoint Enterprise Search to Index and Query Windows File Shares 1.  I created a service account to use as the content access account.  Example:

2.  Ensure file types are correct.
Note: By Default SharePoint search does not include all file types.  I ran a PowerShell command to query the set:
Get-SPEnterpriseSearchServiceApplication | Get-SPEnterpriseSearchCrawlExtension | Sort-Object FileExtension

Then I ran this command to add new file types:
$FileExt     = "jpg"
Get-SPEnterpriseSearchServiceApplication | New-SPEnterpriseSearchCrawlExtension -Name $FileExt

3.  Ensure the default content access account in Search has Share Permissions of: Read.  Security Permissions of: Read & execute, List folder contents, and Read.

4.  I created a new content source so that I can set a different schedule for indexing.  Our corporate file shares are very large so the indexing takes 160+ hours for an incremental.

Upgrade to SharePoint 2010 Service Pack 2

Service Pack 2 for SharePoint 2010 Time to do some testing on my development server prior to upgrading the production system.  I will be doing the In Place upgrade with no rollback.  This will require a server restart and interruption of services intermittently.
First determine the version you need to install.  Technet doesn't expose all of the installs on their page, thankfully Todd Klindt keeps his SharePoint version page up to date. the SharePoint Server with Project Server installer (KB2687452).In my case owstimer.exe threw lots of errors with the Visual Studio Just-In-Time debugger popup.I click cancel on debugging for each error.Reboot server after install complete.Install the Office Web Apps installer (KB2687470).Again more owstimer.exe issues that I cancel through.Open Powershell and run this command:psconfig.exe -cmd upgrade -inplace b2bThis fails the first time, I have read this is common, perhaps to do wi…

Read Current User with JavaScript and use in Button

Grab the currently Logged In User Using JavaScript The Javascript: Place this inside this section: <asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
<script type="text/ecmascript">     var context = null;       var web = null;       var currentUser = null;       var currentUserId='' function getUserData() { context = new SP.ClientContext.get_current();   web = context.get_web();   currentUser = web.get_currentUser();   currentUser.retrieve();   context.load(web);  context.executeQueryAsync(onSuccessMethod, onFailureMethod);        }       function onSuccessMethod()     { var userObject = web.get_currentUser(); var loginName = userObject.get_loginName(); var userAccount = loginName.replace("DOMAIN\\",""); var Url = ("https://[]?sso_key=[somekey]&user_name=" + userAccount + "");;     }
    function onFailureMethod(sender, args)     {  …

SQL Server Rename Database and Filenames

Rename a SQL Server Database and the Filenames to Match Many times I have a need to rename a SharePoint content database or a Team Foundation Server Team Project Collection database name in SQL Server.  The reasons vary, but usually it is because originally the naming of the database is horrible or the purpose of the data has changed and I want all of the references to it to be updated in all systems within the farm.
SQL Commands: Detach Database using sp_detach_db --Note: Change MyDatabase to the database name you want to detach.
USE [master] ALTER DATABASE [MyDatabase] SET SINGLE_USER WITH ROLLBACK IMMEDIATE EXEC master.dbo.sp_detach_db @dbname = N'MyDatabase' Attach Database --Note: Change SqlAndMe to the database name you want to detach.
USE [master] CREATE DATABASE [SqlAndMe] ON  ( FILENAME = N'C:\…\SqlAndMe.mdf'), ( FILENAME = N'C:\…\SqlAndMe_log.LDF') FOR ATTACH Rename Logical Filenames --Note: Change SqlAndMe and MyDatabase to the names you want to cha…

Button - Open Webpage - SharePoint

No Styling <input type="button" value="button name" onclick="'')" />
Styled with Hover Effect <input type="button" value="button name" onclick="'')" class="RiskButton" onmouseover="this.className='RiskButtonHover'" onmouseout="this.className='RiskButton'"/>
CSS: /* BUTTONS */ input.RiskButton { color:#005500; font-weight:bold; font-family:Arial, Helvetica, sans-serif; font-size:x-large; white-space:normal; background-color:#fed; border: 2px solid; border-color: #696 #363 #363 #696; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr='#ffffffff',EndColorStr='#ffeeddaa'); width:240px; height:80px; }  input.RiskButtonHover { color:#005500; font-weight:bold; font-family:Arial, Helvetica, sans-serif; font-size:x-large; white-space:normal; background-color…

SharePoint Announcements View with Ellipses if Body is over 50 Words

Truncate the Body of the announcement if over a certain word count.Restyle the announcement to look modern.Create a link if the Body is truncated so the user can view the full Body.Have this link open a popup window with only the Title and Body shown, with scrollbars.Create a close button on the page to close the window.Execution:

Add a data view of the announcements list to the page.Filter View: Expires >= [Current Date]Add Links to Stylesheets saved in the global library (Before xsl:output):<xsl:import href="/Style Library/XSL Style Sheets/StripHTML.xsl"/><xsl:import href="/Style Library/XSL Style Sheets/FirstNWords.xsl"/>(these can be downloaded here: variable in main stylesheet:<xsl:variable name="WebUrl" select="@FileDirRef"/>Call this stylesheet in rowview template inside the <td></td> section.<xsl:call-template name="EventDisplay"></xsl:call-t…

Close Browser Window

Close a browser window using Javascript: <asp:Button ID="btnClose" runat="server" Text="Close" OnClientClick="javascript:self.close()" />

Connect SharePoint 2010 Web Application to OpenLDAP

Requirements:Company does not want to use Active Directory for external (untrusted) users.  This would consume a user CAL license for each user, along with giving that user potentially more rights on our internal private network domain than wanted.Company uses other enterprise software programs that consume user authentication from a non-central user store and lacks user tracking.  Stand up a central LDAP store for these external users that are accessing these other systems and begin tracking information like phone numbers, address, expected length of access needed, etc.  This will allow IT the ability to inquire if the access is still necessary.Allow Integrated Windows Authentication for normal domain users to interact with content on the Extranet on SharePoint 2010 Server.All SharePoint web sites utilize SSL-only (not even http with alternate access mappings) and Kerberos. Environment: SharePoint Server 2010 EnterpriseServer: Windows Server 2008 R2 with IIS7All web applications inclu…

SharePoint Web Application Debugging Errors

Outputting Verbose Errors Versus the Standard Error Output in SharePoint Verbose error output to the error web page should only be enabled for development or test farms, or temporarily to fix a drastic problem in production.
We will need to edit web.config for the website.  This will be located in the IIS virtual directories, or template/admin in the SharePoint hive for central admin.
Turn on the call stack (CallStack="true")Disable custom errors (<customErrors mode="Off" />)Enable compilation debugging (<compilation batch="false" debug="true">)Edit the following lines: (Ctrl-F is you friend)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>     <configuration>         ...         <SharePoint>             <SafeMode MaxControls="200"                 CallStack="true"                 DirectFileDependencies="10"                 TotalFileDependencies=&qu…

Kerberos for SharePoint 2010

There are some requirements to Kerberos, most notably that your Active Directory domain must be Kerberized.  Also check out this location for the full documentation on setting it up and other requirements like Operating system, etc:

For this demonstration I am assuming the web application(s) you want to use Kerberos on are currently using Classic authentication with NTLM. For claims based authentication you will need to read up on constrained and unconstrained delegation in Kerberos.

1.  Set the web application to use Kerberos.  Do this is Central Administration by clicking on the web application, selecting authentication in the ribbon, choosing the zone you wish to configure (usually Default), and then changing NTLM to Kerberos.

2. SetSPN.  You must register the Service Principal names for each web application pool.  Login to a computer on the domain with a domain administrator account (doesn't have to be the server ho…

SharePoint server EventID 1001 MsiInstaller errors

To monitor this event:
On every server in the SharePoint farm except for the database, create a custom view in Event Viewer.Logged: Last 7 days.By Log: Application.Includes/Excludes: 1000-1030.Click OK.Name: MsiInstaller Errors.Click OK. This will let you monitor this event in the future so you will know if your changes correct the error.  Afterwards delete the custom view when the error doesn't happen for several days.  These events occurred on my system between 52-20 minutes after the hour every hour, usually between 00-15.

Error text:
Detection of product '{90140000-104C-0000-1000-0000000FF1CE}', feature 'PeopleILM' failed during request for component '{1681AE41-ADA8-4B70-BC11-98A5A4EDD046}'

This article explains what is going on:

SharePoint 2010: MsiInstaller errors while attempting to manage a User Profile Service ApplicationWhen you attempt to manage the User Profile Service Application via Central Admin on a Share…