Content Deployment error: Maximum request length exceeded.

Sometimes, when you run a Content Deployment job between a source farm and a destination farm, you may encounter the following issue:

“Content deployment job ‘Job Name’ failed. The remote upload Web request failed.”

When you look in the ULS logs, you may see the following:

File upload of ‘C:\Inetpub\wwwroot\SiteDirectory\ExportedFiles70.cab’ failed. Exception System.Web.HttpException: Maximum request length exceeded.  at System.Web.HttpRequest.GetEntireRawContent()     at System.Web.HttpRequest.get_InputStream()… 

OK, let’s do a web search to see how to fix this issue.  After some searching, you’ll come across posts that tell you to modify maxAllowedContentLength or MaxRequestLength attribute in the Central Administration web.config file (or maybe WFE’s too).  Examples: 

http://technet.microsoft.com/en-us/library/dd795107.aspx

http://weblogs.asp.net/hosamkamel/archive/2007/09/18/resolving-maximum-request-length-exceeded-exception.aspx

I’ve found that if you only modify web.config files as specified in the articles above, it will NOT solve the problem.  

 To solve this problem, you need to increase maxRequestLength value in three places on the TARGET farm:  

  1. Central Administration web.config file (typically located in C:\Inetpub\wwwroot\wss\VirtualDirectories\DirectoryName)
  2. Your web application main web.config file (typically located in C:\Inetpub\wwwroot\wss\VirtualDirectories\DirectoryName).
  3. Content deployment web.config file located in:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\ADMIN\Content Deployment

Note:  You can find out the correct paths for items 1 and 2 by opening IIS Manager.

Open web.config file located at each location and locate the maxRequestLength attribute.  Increase it to allow upload of the largest CAB file that you have.  The default setting limits the upload file size to 51200 KB for CA and web application and to 102400 KB for content deployment.

<configuration>
  <system.web>
    <httpRuntime maxRequestLength=”102400″ />
  </system.web>
</configuration>

You can find out how large the largest CAB file is by running the following command on the source farm Central Administration server:

stsadm -o editcontentdeploymentpath -pathname (pathname here) -keeptemporaryfiles Failure

 This setting will allow you to see the CAB files generated during the content deployment job (in the temp directory specified in the Content Deployment settings screen in Central Administration).

Modify web.config file to display detailed error messages

I was dealing with another one of those “helpful” SharePoint error messages today:

“An unexpected error has occurred.”

Nishant Rana’s blog post had the exact steps needed to get SharePoint to spit out the details:

http://nishantrana.wordpress.com/2009/03/24/%E2%80%9Can-unexpected-error-has-occurred%E2%80%9D-error-message-in-sharepoint/

I’m bookmarking this one!

Content Deployment resources

Find out who’s connected to Windows Server

Sometimes when you try to connect to a server using Remote Desktop (RDP), you might receive this error:

TooManyConnections

(“The terminal server has exceeded the maximum number of allowed connections.”)

This message means that there are at least 2 other active RDP sessions on the server (unless it’s a Terminal Services server, and that’s another story.).  Since you can’t log on, you can’t easily find out who else might be logged on.  One or both of these sessions may be inactive (someone logged in and forgot to log off), and if you’re working on a large team, it may be a hassle to find out who is connected.  Luckily, there’s a built-in tool in Windows Server which will tell you who is connected to your server:  qwinsta.

Here’s how to use it:

1. Log on to another server using an account that has administrative access to the server which is generating the error message.

2. Open command prompt and type in the following:

qwinsta /server:%SERVERNAME%  

where %SERVERNAME% is the name of your server.

More details about the syntax:    qwinsta /?

MS TechNet article:

http://technet.microsoft.com/en-us/library/cc731503(WS.10).aspx

Note:

Another method is to use query session command instead of qwinsta.  The syntax is exactly the same.

Testing access to SharePoint pages

Let’s say you have a long list of SharePoint pages that need to be tested to verify that they’re permissioned correctly.  One way to do it is to take a non-privileged account (end user) and attempt to connect to each of the URLs.  If the page is locked down, you’ll get a page titled “Access denied”; otherwise, the page will load normally.

I recently responded to a thread on SharePoint TechNet about a similar issue and ended up writing a PowerShell script to address it.

The script below will read a text file containing a list of URLs (make sure to modify the source file path with your own path), and then call a function for each URL.  This function will open a new instance of IE, navigate to the URL, wait for the page to load, and then grab the title of the page.  If the user doesn’t have access to the page, the page title will contain “Access denied”; otherwise, the page title will be returned.  Run this script under the credentials of one of your end users.  If you’re trying to open individual documents (Word, Excel, etc.), you may need to modify the script so that it launches correct application (and closes it when done).


# This script will read a text file containing a list of URLs and attempt to connect to each URL.  Successful connection will return the page's title; otherwise, the script will return Access denied error.

# OpenIE function starts here...
# This function launches a new instance of IE and then navigates to the specified URL

function OpenIE($url)
{

if ($url -notlike "http://*")
{

$url = "http://" + $url

}
$ie = new-object -com "InternetExplorer.Application"

$ie.Visible = $true

$ie.Navigate($url)

# wait for IE to load the page

While( $ie.Busy )
{
[System.Threading.Thread]::Sleep(100)
}

# grab page title - if access is denied, the page title will say so

$Title = $ie.Document.Title

$ie.Quit()

return $Title

}

 

# *** Main script routine starts here ***
# specify your source file path here...

$SourceFilePath = "C:\Shared\list.txt"

write-host "Starting script..."

# read the source file into an array of strings, iterate through each one

$list = Get-Content $SourceFilePath

foreach ($item in $list)
{

$result = OpenIE($item)

write-host $item, ";" , $result

}

write-host "Finished."

Maximum string length for SharePoint profile custom properties

Today I needed to create a custom property in SharePoint which would store some long strings.  So naturally, a question came up:  How long can a string be before SharePoint refuses to recognize it?  It appears that the limit is set at 2,000 characters.  When I tried setting the string field length to 2,000 characters and attempted to save the new property, SP would reset it back to the default value of 25.  However, it does accept 1,999 characters or less (see screenshot below). 

SomeCustomProperty

Presenting at the LexMUG October meeting

I presented at the Lexington Microsoft Users Group (www.lexmug.com) meeting today on the topic of functional differences between WSS 3.0 and MOSS 2007.

http://sharepointnomad.files.wordpress.com/2009/10/lexmug_oct2009_presentation-andregalitsky.ppt

Finding out where SharePoint email alias is used

Recently, a question came up in the SharePoint TechNet forums regarding document libraries with incoming email enabled.  If you only know the name of the AD contact for the library, how can you find out which document library or list it’s pointing to? 

Here’s a straightforward PowerShell script which will iterate through every site collection in every web application and return the names and email aliases of every list that has an active email alias specified.


[System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | out-null

[void][System.reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$oContentService = [Microsoft.Sharepoint.Administration.SPWebService]::ContentService;

[Microsoft.SharePoint.Administration.SPWebApplicationCollection]$waColl = $oContentService.webApplications;

$waColl1 = $waColl | where-object {$_.IsAdministrationWebApplication -eq $FALSE}
write-host "WebApplication; Site Collection; List Title; List URL; EmailAlias"

foreach ($wa in $waColl1)
{

$sites = $wa.Sites

foreach ($obj in $sites)

{

$spSite = new-object Microsoft.SharePoint.SPSite($obj.URL)

$colWebsites = $spSite.AllWebs

foreach ($web in $colWebsites)
{

 $colLists = $web.Lists
 
 foreach ($list in $colLists)
 {

 if ( $list.EmailAlias -ne $null )
 {

 write-host  $wa.Name, ";", $obj.URL, ";", $list.Title , ";", $list.DefaultViewUrl, ";",  $list.EmailAlias

 }

 }

}

}

}

write-host "Finished."

Finding out where a list column is used in a site collection

There are times when you need to know where a specific list column is being used in your site collection. This is especially true for custom columns that you may have created. The following script can be used to find which lists are using a specific column name. (I posted this script on the SharePoint TechNet forum in response to a question.)


[System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | out-null 

[void][System.reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") 

# set-up working variables...

# Enter your SharePoint site collection URL here...

$TargetSiteUrl = "http://sharepoint_site_collection_URL" 

# Enter the list column name you want to find here...

$FieldToFind = "Title"

# Starting search

write-host "FieldName, ListName, ListURL"

$spSite = new-object Microsoft.SharePoint.SPSite($TargetSiteUrl) 

$colWebsites = $spSite.AllWebs

foreach ($web in $colWebsites)
{

$colLists = $web.Lists

foreach ($list in $colLists)
{

$fields = $list.Fields

foreach ($item in $fields)
{

If ($item.Title.Contains($FieldToFind))
{
write-host  $item.Title, ";", $list.Title, ";", $list.DefaultViewUrl
}

}

}

}

write-host "Finished."

Lori’s Infopath tip: You can auto-populate another user’s profile info

For much of the past few weeks, I thought it wasn’t possible to auto-populate fields in Infopath using the Contact Selector ActiveX control, beyond the three standard fields it comes with (DisplayName, AccountId, and AccountType). I needed to populate my InfoPath form with WorkEmail and Department attributes, but it seemed that the only reliable way to do it was via code.

That is, until I got it to work using Lori Gowin’s post (see here: http://seethepoint.spaces.live.com/blog/cns!CDB633EE9271C6FA!163.entry?sa=608624574)

Lori’s new blog URL: http://www.pointgowin.com/SeeThePoint/default.aspx

I’m re-posting Lori’s steps here for posterity (just in case her blog mysteriously disappears…). I’ve also added an initial step to set up a connection to UserProfileService which is needed for the controls to work properly.



Adding a Contact Selector control to auto-populate another user’s profile details in InfoPath


Step 1: Add a connection to the UserProfileService.

1. Click on Tools > Data Connections > Create a new connection. Select “Receive data”, click Next.
2. Select “Web Service” and click “Next”.
3. Enter UserProfileService URL (enter your server name here):

http://SERVERNAME/_vti_bin/userprofileservice.asmx

click Next

4. Select “GetUserProfileByName” method and click Next.
5. At the next screen, leave default values intact and click Next.
6. At the next screen, leave default values intact and click Next.
7. Enter a name for this data connection, for example “GetOTHERuserProfileByName”.
Make sure to UNCHECK “Automatically retrieve data when form is opened” checkbox. Click Finish.

Step 2: Add the Contact Selector control to InfoPath – this only has to be done once within InfoPath, then it will be available for future forms.

1. From the Controls task pane, click on “Add or Remove Custom Controls…” then click Add.
2. Select “ActiveX Control” then click Next.
3. Locate “Contact Selector” in the list, select it, then click Next.
4. Ensure “Don’t install a .cab file” is selected, click Next.
5. Set the Binding Property to “Value”, click Next.
6. In the drop-down menu for field or group type, select “Field or Group (any data type)” then click Finish.
7. Click Close, click OK.

Step 3: Add a data connection – this must be done for each new form created.

There is some preliminary work here, first you have to create an XML file and save it. Open notepad and paste: <Context siteUrl="http://”/>. Save the file as Context.xml. This same file can be used each time you create a new data connection of this type.

1. In InfoPath click Tools>Data Connections, then click the Add button.
2. Select “Create a ne connection to:” and “Receive data”, click Next.
3. Select “XML Document” and click Next.
4. Browse to the Context.xml file you created in notepad, click Next.
5. “Include the data as a resource file in the form template or template part” should be selected, click Next.
6. Leave the connection named “Context” and automatically retrieve the data when the form is opened, click Finish.

Step 4: Add the control to the form.

1. Drag and drop the control to the desired location on the form.
2. Go to the Data Source task panel.
3. Modify the data source so that the group that is created by the new control is exactly like the data source pictured. The “Person” group is a repeating group, the field names are case sensitive.

The control on the form that can be used to lookup users in Active Directory. Which is pretty nice if the DisplayName and Account ID are all the information that is needed. Here’s how to get more:

Step 5: Add your rules.

1. While in the Data Source task pane, create a field in the main data source (but not in your Contact Selector group) and name it something meaningful. I use HiddenAccountName to keep it distinct from the field in the Contact Selector group.
2. Click the drop-down menu on your data field in the data source, click “Properties”, then click the function button to set the default data.
3. Click “Insert Field or Group…”
4. Select the AccountId field from your contact selector group, then click OK on each window until the Field or Group Properties is showing(2 times).

5. Click the Rules and Merge tab, click Add.
6. Don’t set any conditions, this rule always applies, click Add Action.
7. Select “Set a field’s value” from the drop down.
8. Click the data source button next to the “Field” field.
9. Select the data source you wish to use for the lookup in the drop-down menu. *Be sure you don’t re-use the connection for the current user data if you have one in this form.
10. Expand the query fields and sub-groups, then select “Account Name”, click OK.

11. Click the function button next to the “Value” field, then click Insert Field or Group.
12. Select the current field you created in step 1 above, click OK until all windows are closed (3 times).
13. In the data source pane, use the drop-down menu to select the data source that you will use to look up another user’s profile information.
14. Expand the query fields and all sub groups until the field AccountName is visible. Click the drop-down menu on the AccountName field, then click properties.
15. Click on the Rules and Merge tab, then click Add.
16. Do not set any conditions, this rule will always apply. Click Add Action.
17. Select “Query using a data connection” from the drop-down menu.
18. Select the data connection you wish to use for the lookup from the drop-down menu (it should be the same as the data source listed in the task pane), then click OK.
19. Click Add Action.
20. Select “Set a field’s value” from the drop-down.
21. Click on the data source button next to the “Field” field.
22. Ensure you change the data source to “Main” and select the field you wish to auto-populate, then click OK.
23. Select the function button next to the “Value” field, then click Insert Field or Group.
24. Expand the data fields group and all sub-groups, select “Value”, click Filter Data, then click Add.
25. Where the “Value” field is defaulted, click the drop-down and select “Select a field or group…”
26. Select the “Name” field under “Property Values”, click OK.
27. In the third field, click the drop-down and select “Type Text”.
28. Type the property from the user profile that you wish to enter in the field, then click OK until you are back to the “Rule” window (5 times).
Repeat steps 19 through 28 for all fields that you wish to have auto-populate with the other user’s data. It is important that “Query using a data connection” remain the first action. If it is not the first action, highlight that action and move it up until it is the first.
29. Click OK on all windows until you are back to your form.

Now you have a contact selector that allows a user to look up another user in AD and have their profile properties auto-populate fields on the form.

Next Page »


RSS Ben Curry’s Blog

  • I'm at the ATL users group Monday night, Nov 16th November 15, 2009
  • Upgrading to SharePoint Server 2010 November 3, 2009

Blog Stats

  • 4,474 hits