The problem:
When you have a List View WebPart on a SharePoint page that has paging enabled, when you click on the paging button to move forward or backward in the List view, the webpart clears any existing query string parameters when posting back to get the next page of information. This is a big problem if the page relies on the query string to display dynamic information.
So, if I have a custom aspx page that displays dynamic information about an item with ID=5, I would have a URL like this:
http://machine.domain.com/sites/somesite/CustomPage.aspx?ID=5
When you click on the “Next Page” button on the List View Webpart it wants to clear the query string and navigate to something that looks similar to this:
http://machine.domain.com/sites/somesite/CustomPage.aspx?Paged=TRUE&p_ID=38&View={5E53C811-1C34-4F1D-B1CB-E83E92712CEF}&FolderCTID=0×012001&PageFirstRow=9
Notice that my CustomPage.aspx “ID=5″ parameter is missing!!
A Technique to Fix the Problem:
Rather than code a custom webpart the following javascript can be placed in the source of a Content Editing Web Part directly below the List View Webpart. When it executes it will re-write all the URLs to include the original query string.
(more…)
To set a Date and Time field for SharePoint list items in your code you have to guarantee that dates are in invariant format or you will have problems. It is possible to assign value of DateTime type to this field or a string.
Invariant format is: MM/dd/yyyy HH:mm:ss
If you want to assign the date as a string to SharePoint’s DateTime type field then you must format this string as an invariant date. The following code snippet sets a workflow item’s Date and Time column to the current time.
Imports System.Globalization
workflowproperties.Item["TheDate"] = DateTime.Now.ToString(DateTimeFormatInfo.InvariantInfo)
workflowproperties.Item.SystemUpdate()
If you make sure dates are always in invariant format then assigning values to DateTime fields is easy.
We have a webservice that we want to connect to using HTTPS and the FQDN. This causes a problem when using SSL specifically because some of the schema locations have the NetBIOS name referenced and SSL will fail because the certificate does not match the NetBIOS host-name. Below, notice how the NetBIOS name “corpweb” is referenced instead of the FQDN that will be expected during SSL negotiation.
To display this info I simply referenced:
https://corpweb.domain.com/WebReportingService/WebFeed.svc?wsdl

Netbios in wdsl
The NetBIOS name is automatically used by the WCF. To get the webservice to use the FQDN you need to change the IIS metabase bindings. (more…)
Recently I was trying to port a content database to a new farm and wanted to create a site on the farm that pointed to a restored SQL database on my SQL Server.
So my steps were as follows:
- Backup original SQL Content DB using SQL Management Tool
- Copy the Content DB backup up file to the other SQL DB Server
- Use SQL management tool on the new server to restore to a database that didn’t exist
- Run the following “stsadm” command to attach a new site to this SQL Content DB.
stsadm -o createsiteinnewdb -url http://sites/SomeSite -owneremail SharePoint@Someplace.com
-ownerlogin somplace\sharepointowner -sitetemplate STS#0 -title "Name of the site"
-databaseserver mosssqlsvr
-databasename Name_of_restored_DB
(more…)
This is a trick to Edit SharePoint Web Pages within the Browser when the “Edit Page” is greyed Out. We like to add Java script to Content Editor Web Parts and not to the actual source of a page within SharePoint Designer. For most pages this is not a problem, but for the pages associated with a List like “NewForm.aspx” the “Edit Page” selection under “Site Settings” is greyed out.

"Edit Page" Greyed Out
Since the source of a Content Editor Web Part can only be edited using the browser, this makes it hard for us to add Java script in our typical manor. (more…)
In our situation we migrate content databases on a regular basis between our MOSS Sandbox environment to our Production and Staging environments. I ran into a situation where we ported a Sandbox content database to the Staging environment so we could begin unit testing. Although external Email was functioning, proven by other alerts on list items, our workflow task notifications were not being sent.
Found the following Log entry that seemed to be relavant:
09/16/2009 15:45:24.70 OWSTIMER.EXE (0×0660) 0x0DDC Windows SharePoint Services Timer 9e99 High AlertsJob failed to initialize site collection for Subscription id: {F51BE5D2-8142-4826-A7CC-DE03C7BA17C8}. Possibly incorrect siteurl http://mosssbx/sites/Test for site collection Id: {352E8E65-1A15-4953-98F6-4D2899492DB1},HRESULT 0×80070002
So I knew we had a database entry somewhere still pointing at my mosssbx site! (more…)
Most of this info came from this post:
http://vspug.com/joed/2008/02/28/be-careful-with-the-bdc-hurricane-button/
When you add a Business Data Catalog (BDC) column to a custom list, in the list view column headings you will see an icon with two green circular arrows next to the BDC column – it looks a little like the symbol for a hurricane. This is the “BDC Update” (or “refresh” button).

(more…)
This was kind of more difficult than I would have expected. This is the technique I’ve been able to use successfully to copy document library list items from one list to another. I had to work through a number of problems including a confusing error from Visual Studio: “To add an item to a document library, use SPFileCollection.Add()”
SPFileCollection? WTF, I thought I was dealing with a List!!
Below is the coding technique I finally was able to get to work.
- Add a new file to the document library first using the SPFileCollection class.
- From the file get the SPListItem object for the new item
- Update the fields of the new list item
- Use newitem.Update to commit the changes
' Code to COPY a document library list item to a new document library List
' Get a reference to the destination List.
Dim destlist As SPList = workflowProperties.Web.Lists("Destination")
Dim sourceitem As SPListItem = workflowProperties.Item
Dim filebytes As Byte()
Dim newitem As SPListItem
' Gets the source file from the source list
Dim thefile As SPFile = sourceitem.File
Dim ct As SPContentType
Dim field As SPField
Dim destrelativeurl As String = destlist.RootFolder.Url & "/" & sourceitem.File.Name
' Suck the source file into binary array
filebytes = sourceitem.File.OpenBinary
' This creates an entry in the destination list and returns SPFile obj
thefile = destlist.RootFolder.Files.Add(destrelativeurl, filebytes, True)
' We can now use the SPFile obj to get the new list entry.
newitem = thefile.Item
' cycle through each of the fields setting them to be the same if the
' are fields that are not Read Only
For Each field In sourceitem.Fields
If Not field.ReadOnlyField Then
Try
' Set the matching field in the destination list
' The Source list might not have the same number of columns so we enclose this
' in a TRY so that if a column doesn't exist in the destination it continues.
newitem(field.Title) = sourceitem(field.Title)
End Try
End If
Next
' Commit the changes
newitem.Update()
Many thanks to this blog post for pointing me in the right direction