creating a multiple selection list box in a browser enabled infopath form
TRANSCRIPT
Creating a Multiple Selection List Box from a SharePoint List in a
Browser Enabled InfoPath Form (and Publish it to SharePoint) Jennifer Lewis
Reader Assumptions Reader is familiar with Infopath
Reader has basic understanding of code
Reader is familiar with SharePoint administration
Prerequisites You must have the following installed on your machine
InfoPath 2007
Net Programmability Support for Microsoft Office InfoPath
Overview Multiple selection list boxes are supported in client-based InfoPath forms but they are not supported in
browser-based forms This document explains how to work around the limitation using code-behind in
Infopath the owssvrdll service call and publishing an administrative template in SharePoint
In this example we will be using the following information Please substitute the information with the
information germane to your environment
Wersquore going to be using a web site called httpmoss2007-dev8318 (Playground)
The list containing the values to be displayed in the checkbox will be in a custom list called
Branches
The InfoPath form will be called InventoryItem
Step 1 Create a Custom Data Structure in the InfoPath 2007 form 1 Create a data structure in your InfoPath 2007 form The structure should appear similar to this
a Create a repeating group You can call this anything you like but for the example we will
call it MultiSelectOptions
b From the repeating group create two elements One element will represent the checkbox
and the other element will represent the text to appear for the checkbox For our example
we will call these selectedOption and optionDescription but you may call these fields
something else Be sure to make the field representing the checkbox as a truefalse
(Boolean) datatype
Checkbox
Checkbox Description
c Your data source should look similar to this
2 Add the repeating table on your form Add as a repeating table
3 Format your table to your preference
Step 2 Create a data connection to the SharePoint list using owssvrdll Even though we can connect directly to a SharePoint list we canrsquot populate the ldquocheckboxesrdquo with the
list data because technically wersquore working with an XML structure thatrsquos simulating multiple
checkboxes What we need to do is retrieve the list data as an XML structure In order to do this we
will need to call the owssvrdll service
Before you use the owssvrdll server you will need the GUID of the list If you are also going to
reference a view of the list you will also need the GUID of the view
To get the GUID of the list
1 Select Settings ndash List Settings
The GUID will appear in the URL in the List query string parameter
Do the following with the GUID
Replace 7B with
Replace 2D with ndash
Replace 7D with
In our example the GUID will be 356671C3-DB57-4385-8F0E-0A3B991A6457
To get the GUID of the view
1 In the View drop-down field select the view you would like to use
2 In the View drop-down field select Modify this View
The GUID will appear in the URL in the View query string parameter
Do the following with the GUID
Replace 7B with
Replace 2D with ndash
Replace 7D with
In our example we wonrsquot be using the view
Once you have the GUIDs you are able to set up the data connections
1 Add a new data connection
2 Select Create a new connection to Receive data
1 Select XML Document for the source
2 In the location field enter the URL to the owssvrdll call
The generic URL is
http[url]_vti_binowssvrdllCmd=Displayamp[Parms]ampXMLDATA=TRUE
In our example wersquore only interested in using the List so the parameter that we will use is List
Here is the example URL that we will be using
httpmoss2007-dev8318_vti_binowssvrdllCmd=DisplayampList=356671C3-DB57-4385-8F0E-
0A3B991A6457ampXMLDATA=TRUE
If you would like further reading on this please view the appendix at the end of the documents
3 Select Access the data from the specified location Do not check Store a copy of the data for
offline use
4 Enter a user friendly name for the connection and click Finish Make sure that Automatically
retrieve data when form is opened is checked
Step 3 Write code-behind to automatically populate the checkboxes
Before you begin you may want to configure the form to determine
What language you will be using
Where you would like the code-behind project to reside
1 Select Tools ndash Form Options
2 Select Programming
3 Select your language from the Form template code language drop-down (C or Visual Basic)
4 Select the location for the code
Now you are ready to create code
5 From the main menu select Tools ndash Programming ndash Loading Event
If you have VSTA installed on your machine you will see the following similar screen Note that
your code may appear differently depending upon the language that you selected
6 Add the following code for the FormEvents_Loading event Remember to substitute
C public void FormEvents_Loading(object sender LoadingEventArgs e)
try
thisErrorsDeleteAll()
if
(thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSel
ectOptions thisNamespaceManager)Count lt= 1)
thisLoadMultiSelectListBox()
catch (Exception exception)
VB Public Sub FormEvents_Loading(sender As Object e As LoadingEventArgs)
Try
MeErrorsDeleteAll()
If
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)Count lt= 1 Then
MeLoadMultiSelectListBox()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
7 Add the following code for the LoadMultiSelectListBox
C private void LoadMultiSelectListBox()
try
thisErrorsDeleteAll()
((FileQueryConnection)thisDataConnections[Locations])Execute()
foreach (XPathNavigator navigator2 in
thisDataSources[Locations]CreateNavigator()SelectSingleNode(rs
data thisNamespaceManager)Select(zrow thisNamespaceManager))
thisAddMultiSelectReasons(navigator2)
if
(thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) =
null)
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])Delete
Self()
catch (Exception exception)
VB Private Sub LoadMultiSelectListBox()
Try
MeErrorsDeleteAll()
DirectCast(MeDataConnections(Locations)
FileQueryConnection)Execute()
For Each navigator2 As XPathNavigator In
MeDataSources(Locations)CreateNavigator()SelectSingleNode(rsda
ta MeNamespaceManager)[Select](zrow MeNamespaceManager)
MeAddMultiSelectReasons(navigator2)
Next
If
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) IsNot
Nothing Then
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])D
eleteSelf()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
Substitute the ldquoLocationsrdquo for the name of your data connection
8 Add the following code for the AddMultiSelectReasons
C private void AddMultiSelectReasons(XPathNavigator item)
try
thisErrorsDeleteAll()
XPathNavigator currentXPathNav =
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
XPathNavigator newSibling = null
if (currentXPathNav = null)
newSibling = currentXPathNavClone()
XPathNavigator navigator3 =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription thisNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
stringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = null
catch (Exception exception)
VB Private Sub AddMultiSelectReasons(item As XPathNavigator)
Try
MeErrorsDeleteAll()
Dim currentXPathNav As XPathNavigator =
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
Dim newSibling As XPathNavigator = Nothing
If currentXPathNav IsNot Nothing Then
newSibling = currentXPathNavClone()
End If
Dim navigator3 As XPathNavigator =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription MeNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
StringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = Nothing
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
9 Write the following code for GetCurrentXPathNav
C public XPathNavigator GetCurrentXPathNav(string XPath)
return
thisMainDataSourceCreateNavigator()SelectSingleNode(XPath
thisNamespaceManager)
VB Public Function GetCurrentXPathNav(XPath As String) As
XPathNavigator
Return
MeMainDataSourceCreateNavigator()SelectSingleNode(XPath
MeNamespaceManager)
End Function
10 To test the code click the debug run button in Visual Studio
Step 4 (optional) Write code-behind to ldquosaverdquo the selected checkboxes for
further processing You really donrsquot have to do this step because InfoPath will save the selections when the end user
clicks Save However you may need to save the selections to be used for something else such as
Neat trick to get the correct XPath
1 In the data source right-click on the item and select Copy XPath
2 Go to your code and paste the XPath
displaying the selections in the SharePoint list The following code will show how to write code to save
the selected items
1 Create an element off the root item to store the values In my example I will be calling it
selectedItems
2 Add the following code within the InternalStartup function
C EventManagerXmlEvents[mymyFieldsmyMultiSelectOptionsmyselectedO
ption]Changed += new XmlChangedEventHandler(selectedOption_Changed)
VB EventManagerXmlEvents(mymyFieldsmyMultiSelectOptionsmyselectedO
ption)Changed += New XmlChangedEventHandler(selectedOption_Changed)
3 Add the following code for the selectedOption_Changed event
C public void selectedOption_Changed(object sender XmlEventArgs e)
SaveMultiSelectListItems()
VB Public Sub selectedOption_Changed(sender As Object e As XmlEventArgs)
SaveMultiSelectListItems()
End Sub
4 Add the following code for the SaveMultiSelectLIstItems function
C private void SaveMultiSelectListItems()
try
thisErrorsDeleteAll()
XPathNodeIterator iterator =
thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSele
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
b From the repeating group create two elements One element will represent the checkbox
and the other element will represent the text to appear for the checkbox For our example
we will call these selectedOption and optionDescription but you may call these fields
something else Be sure to make the field representing the checkbox as a truefalse
(Boolean) datatype
Checkbox
Checkbox Description
c Your data source should look similar to this
2 Add the repeating table on your form Add as a repeating table
3 Format your table to your preference
Step 2 Create a data connection to the SharePoint list using owssvrdll Even though we can connect directly to a SharePoint list we canrsquot populate the ldquocheckboxesrdquo with the
list data because technically wersquore working with an XML structure thatrsquos simulating multiple
checkboxes What we need to do is retrieve the list data as an XML structure In order to do this we
will need to call the owssvrdll service
Before you use the owssvrdll server you will need the GUID of the list If you are also going to
reference a view of the list you will also need the GUID of the view
To get the GUID of the list
1 Select Settings ndash List Settings
The GUID will appear in the URL in the List query string parameter
Do the following with the GUID
Replace 7B with
Replace 2D with ndash
Replace 7D with
In our example the GUID will be 356671C3-DB57-4385-8F0E-0A3B991A6457
To get the GUID of the view
1 In the View drop-down field select the view you would like to use
2 In the View drop-down field select Modify this View
The GUID will appear in the URL in the View query string parameter
Do the following with the GUID
Replace 7B with
Replace 2D with ndash
Replace 7D with
In our example we wonrsquot be using the view
Once you have the GUIDs you are able to set up the data connections
1 Add a new data connection
2 Select Create a new connection to Receive data
1 Select XML Document for the source
2 In the location field enter the URL to the owssvrdll call
The generic URL is
http[url]_vti_binowssvrdllCmd=Displayamp[Parms]ampXMLDATA=TRUE
In our example wersquore only interested in using the List so the parameter that we will use is List
Here is the example URL that we will be using
httpmoss2007-dev8318_vti_binowssvrdllCmd=DisplayampList=356671C3-DB57-4385-8F0E-
0A3B991A6457ampXMLDATA=TRUE
If you would like further reading on this please view the appendix at the end of the documents
3 Select Access the data from the specified location Do not check Store a copy of the data for
offline use
4 Enter a user friendly name for the connection and click Finish Make sure that Automatically
retrieve data when form is opened is checked
Step 3 Write code-behind to automatically populate the checkboxes
Before you begin you may want to configure the form to determine
What language you will be using
Where you would like the code-behind project to reside
1 Select Tools ndash Form Options
2 Select Programming
3 Select your language from the Form template code language drop-down (C or Visual Basic)
4 Select the location for the code
Now you are ready to create code
5 From the main menu select Tools ndash Programming ndash Loading Event
If you have VSTA installed on your machine you will see the following similar screen Note that
your code may appear differently depending upon the language that you selected
6 Add the following code for the FormEvents_Loading event Remember to substitute
C public void FormEvents_Loading(object sender LoadingEventArgs e)
try
thisErrorsDeleteAll()
if
(thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSel
ectOptions thisNamespaceManager)Count lt= 1)
thisLoadMultiSelectListBox()
catch (Exception exception)
VB Public Sub FormEvents_Loading(sender As Object e As LoadingEventArgs)
Try
MeErrorsDeleteAll()
If
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)Count lt= 1 Then
MeLoadMultiSelectListBox()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
7 Add the following code for the LoadMultiSelectListBox
C private void LoadMultiSelectListBox()
try
thisErrorsDeleteAll()
((FileQueryConnection)thisDataConnections[Locations])Execute()
foreach (XPathNavigator navigator2 in
thisDataSources[Locations]CreateNavigator()SelectSingleNode(rs
data thisNamespaceManager)Select(zrow thisNamespaceManager))
thisAddMultiSelectReasons(navigator2)
if
(thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) =
null)
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])Delete
Self()
catch (Exception exception)
VB Private Sub LoadMultiSelectListBox()
Try
MeErrorsDeleteAll()
DirectCast(MeDataConnections(Locations)
FileQueryConnection)Execute()
For Each navigator2 As XPathNavigator In
MeDataSources(Locations)CreateNavigator()SelectSingleNode(rsda
ta MeNamespaceManager)[Select](zrow MeNamespaceManager)
MeAddMultiSelectReasons(navigator2)
Next
If
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) IsNot
Nothing Then
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])D
eleteSelf()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
Substitute the ldquoLocationsrdquo for the name of your data connection
8 Add the following code for the AddMultiSelectReasons
C private void AddMultiSelectReasons(XPathNavigator item)
try
thisErrorsDeleteAll()
XPathNavigator currentXPathNav =
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
XPathNavigator newSibling = null
if (currentXPathNav = null)
newSibling = currentXPathNavClone()
XPathNavigator navigator3 =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription thisNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
stringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = null
catch (Exception exception)
VB Private Sub AddMultiSelectReasons(item As XPathNavigator)
Try
MeErrorsDeleteAll()
Dim currentXPathNav As XPathNavigator =
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
Dim newSibling As XPathNavigator = Nothing
If currentXPathNav IsNot Nothing Then
newSibling = currentXPathNavClone()
End If
Dim navigator3 As XPathNavigator =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription MeNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
StringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = Nothing
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
9 Write the following code for GetCurrentXPathNav
C public XPathNavigator GetCurrentXPathNav(string XPath)
return
thisMainDataSourceCreateNavigator()SelectSingleNode(XPath
thisNamespaceManager)
VB Public Function GetCurrentXPathNav(XPath As String) As
XPathNavigator
Return
MeMainDataSourceCreateNavigator()SelectSingleNode(XPath
MeNamespaceManager)
End Function
10 To test the code click the debug run button in Visual Studio
Step 4 (optional) Write code-behind to ldquosaverdquo the selected checkboxes for
further processing You really donrsquot have to do this step because InfoPath will save the selections when the end user
clicks Save However you may need to save the selections to be used for something else such as
Neat trick to get the correct XPath
1 In the data source right-click on the item and select Copy XPath
2 Go to your code and paste the XPath
displaying the selections in the SharePoint list The following code will show how to write code to save
the selected items
1 Create an element off the root item to store the values In my example I will be calling it
selectedItems
2 Add the following code within the InternalStartup function
C EventManagerXmlEvents[mymyFieldsmyMultiSelectOptionsmyselectedO
ption]Changed += new XmlChangedEventHandler(selectedOption_Changed)
VB EventManagerXmlEvents(mymyFieldsmyMultiSelectOptionsmyselectedO
ption)Changed += New XmlChangedEventHandler(selectedOption_Changed)
3 Add the following code for the selectedOption_Changed event
C public void selectedOption_Changed(object sender XmlEventArgs e)
SaveMultiSelectListItems()
VB Public Sub selectedOption_Changed(sender As Object e As XmlEventArgs)
SaveMultiSelectListItems()
End Sub
4 Add the following code for the SaveMultiSelectLIstItems function
C private void SaveMultiSelectListItems()
try
thisErrorsDeleteAll()
XPathNodeIterator iterator =
thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSele
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
c Your data source should look similar to this
2 Add the repeating table on your form Add as a repeating table
3 Format your table to your preference
Step 2 Create a data connection to the SharePoint list using owssvrdll Even though we can connect directly to a SharePoint list we canrsquot populate the ldquocheckboxesrdquo with the
list data because technically wersquore working with an XML structure thatrsquos simulating multiple
checkboxes What we need to do is retrieve the list data as an XML structure In order to do this we
will need to call the owssvrdll service
Before you use the owssvrdll server you will need the GUID of the list If you are also going to
reference a view of the list you will also need the GUID of the view
To get the GUID of the list
1 Select Settings ndash List Settings
The GUID will appear in the URL in the List query string parameter
Do the following with the GUID
Replace 7B with
Replace 2D with ndash
Replace 7D with
In our example the GUID will be 356671C3-DB57-4385-8F0E-0A3B991A6457
To get the GUID of the view
1 In the View drop-down field select the view you would like to use
2 In the View drop-down field select Modify this View
The GUID will appear in the URL in the View query string parameter
Do the following with the GUID
Replace 7B with
Replace 2D with ndash
Replace 7D with
In our example we wonrsquot be using the view
Once you have the GUIDs you are able to set up the data connections
1 Add a new data connection
2 Select Create a new connection to Receive data
1 Select XML Document for the source
2 In the location field enter the URL to the owssvrdll call
The generic URL is
http[url]_vti_binowssvrdllCmd=Displayamp[Parms]ampXMLDATA=TRUE
In our example wersquore only interested in using the List so the parameter that we will use is List
Here is the example URL that we will be using
httpmoss2007-dev8318_vti_binowssvrdllCmd=DisplayampList=356671C3-DB57-4385-8F0E-
0A3B991A6457ampXMLDATA=TRUE
If you would like further reading on this please view the appendix at the end of the documents
3 Select Access the data from the specified location Do not check Store a copy of the data for
offline use
4 Enter a user friendly name for the connection and click Finish Make sure that Automatically
retrieve data when form is opened is checked
Step 3 Write code-behind to automatically populate the checkboxes
Before you begin you may want to configure the form to determine
What language you will be using
Where you would like the code-behind project to reside
1 Select Tools ndash Form Options
2 Select Programming
3 Select your language from the Form template code language drop-down (C or Visual Basic)
4 Select the location for the code
Now you are ready to create code
5 From the main menu select Tools ndash Programming ndash Loading Event
If you have VSTA installed on your machine you will see the following similar screen Note that
your code may appear differently depending upon the language that you selected
6 Add the following code for the FormEvents_Loading event Remember to substitute
C public void FormEvents_Loading(object sender LoadingEventArgs e)
try
thisErrorsDeleteAll()
if
(thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSel
ectOptions thisNamespaceManager)Count lt= 1)
thisLoadMultiSelectListBox()
catch (Exception exception)
VB Public Sub FormEvents_Loading(sender As Object e As LoadingEventArgs)
Try
MeErrorsDeleteAll()
If
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)Count lt= 1 Then
MeLoadMultiSelectListBox()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
7 Add the following code for the LoadMultiSelectListBox
C private void LoadMultiSelectListBox()
try
thisErrorsDeleteAll()
((FileQueryConnection)thisDataConnections[Locations])Execute()
foreach (XPathNavigator navigator2 in
thisDataSources[Locations]CreateNavigator()SelectSingleNode(rs
data thisNamespaceManager)Select(zrow thisNamespaceManager))
thisAddMultiSelectReasons(navigator2)
if
(thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) =
null)
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])Delete
Self()
catch (Exception exception)
VB Private Sub LoadMultiSelectListBox()
Try
MeErrorsDeleteAll()
DirectCast(MeDataConnections(Locations)
FileQueryConnection)Execute()
For Each navigator2 As XPathNavigator In
MeDataSources(Locations)CreateNavigator()SelectSingleNode(rsda
ta MeNamespaceManager)[Select](zrow MeNamespaceManager)
MeAddMultiSelectReasons(navigator2)
Next
If
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) IsNot
Nothing Then
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])D
eleteSelf()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
Substitute the ldquoLocationsrdquo for the name of your data connection
8 Add the following code for the AddMultiSelectReasons
C private void AddMultiSelectReasons(XPathNavigator item)
try
thisErrorsDeleteAll()
XPathNavigator currentXPathNav =
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
XPathNavigator newSibling = null
if (currentXPathNav = null)
newSibling = currentXPathNavClone()
XPathNavigator navigator3 =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription thisNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
stringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = null
catch (Exception exception)
VB Private Sub AddMultiSelectReasons(item As XPathNavigator)
Try
MeErrorsDeleteAll()
Dim currentXPathNav As XPathNavigator =
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
Dim newSibling As XPathNavigator = Nothing
If currentXPathNav IsNot Nothing Then
newSibling = currentXPathNavClone()
End If
Dim navigator3 As XPathNavigator =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription MeNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
StringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = Nothing
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
9 Write the following code for GetCurrentXPathNav
C public XPathNavigator GetCurrentXPathNav(string XPath)
return
thisMainDataSourceCreateNavigator()SelectSingleNode(XPath
thisNamespaceManager)
VB Public Function GetCurrentXPathNav(XPath As String) As
XPathNavigator
Return
MeMainDataSourceCreateNavigator()SelectSingleNode(XPath
MeNamespaceManager)
End Function
10 To test the code click the debug run button in Visual Studio
Step 4 (optional) Write code-behind to ldquosaverdquo the selected checkboxes for
further processing You really donrsquot have to do this step because InfoPath will save the selections when the end user
clicks Save However you may need to save the selections to be used for something else such as
Neat trick to get the correct XPath
1 In the data source right-click on the item and select Copy XPath
2 Go to your code and paste the XPath
displaying the selections in the SharePoint list The following code will show how to write code to save
the selected items
1 Create an element off the root item to store the values In my example I will be calling it
selectedItems
2 Add the following code within the InternalStartup function
C EventManagerXmlEvents[mymyFieldsmyMultiSelectOptionsmyselectedO
ption]Changed += new XmlChangedEventHandler(selectedOption_Changed)
VB EventManagerXmlEvents(mymyFieldsmyMultiSelectOptionsmyselectedO
ption)Changed += New XmlChangedEventHandler(selectedOption_Changed)
3 Add the following code for the selectedOption_Changed event
C public void selectedOption_Changed(object sender XmlEventArgs e)
SaveMultiSelectListItems()
VB Public Sub selectedOption_Changed(sender As Object e As XmlEventArgs)
SaveMultiSelectListItems()
End Sub
4 Add the following code for the SaveMultiSelectLIstItems function
C private void SaveMultiSelectListItems()
try
thisErrorsDeleteAll()
XPathNodeIterator iterator =
thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSele
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
2 Add the repeating table on your form Add as a repeating table
3 Format your table to your preference
Step 2 Create a data connection to the SharePoint list using owssvrdll Even though we can connect directly to a SharePoint list we canrsquot populate the ldquocheckboxesrdquo with the
list data because technically wersquore working with an XML structure thatrsquos simulating multiple
checkboxes What we need to do is retrieve the list data as an XML structure In order to do this we
will need to call the owssvrdll service
Before you use the owssvrdll server you will need the GUID of the list If you are also going to
reference a view of the list you will also need the GUID of the view
To get the GUID of the list
1 Select Settings ndash List Settings
The GUID will appear in the URL in the List query string parameter
Do the following with the GUID
Replace 7B with
Replace 2D with ndash
Replace 7D with
In our example the GUID will be 356671C3-DB57-4385-8F0E-0A3B991A6457
To get the GUID of the view
1 In the View drop-down field select the view you would like to use
2 In the View drop-down field select Modify this View
The GUID will appear in the URL in the View query string parameter
Do the following with the GUID
Replace 7B with
Replace 2D with ndash
Replace 7D with
In our example we wonrsquot be using the view
Once you have the GUIDs you are able to set up the data connections
1 Add a new data connection
2 Select Create a new connection to Receive data
1 Select XML Document for the source
2 In the location field enter the URL to the owssvrdll call
The generic URL is
http[url]_vti_binowssvrdllCmd=Displayamp[Parms]ampXMLDATA=TRUE
In our example wersquore only interested in using the List so the parameter that we will use is List
Here is the example URL that we will be using
httpmoss2007-dev8318_vti_binowssvrdllCmd=DisplayampList=356671C3-DB57-4385-8F0E-
0A3B991A6457ampXMLDATA=TRUE
If you would like further reading on this please view the appendix at the end of the documents
3 Select Access the data from the specified location Do not check Store a copy of the data for
offline use
4 Enter a user friendly name for the connection and click Finish Make sure that Automatically
retrieve data when form is opened is checked
Step 3 Write code-behind to automatically populate the checkboxes
Before you begin you may want to configure the form to determine
What language you will be using
Where you would like the code-behind project to reside
1 Select Tools ndash Form Options
2 Select Programming
3 Select your language from the Form template code language drop-down (C or Visual Basic)
4 Select the location for the code
Now you are ready to create code
5 From the main menu select Tools ndash Programming ndash Loading Event
If you have VSTA installed on your machine you will see the following similar screen Note that
your code may appear differently depending upon the language that you selected
6 Add the following code for the FormEvents_Loading event Remember to substitute
C public void FormEvents_Loading(object sender LoadingEventArgs e)
try
thisErrorsDeleteAll()
if
(thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSel
ectOptions thisNamespaceManager)Count lt= 1)
thisLoadMultiSelectListBox()
catch (Exception exception)
VB Public Sub FormEvents_Loading(sender As Object e As LoadingEventArgs)
Try
MeErrorsDeleteAll()
If
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)Count lt= 1 Then
MeLoadMultiSelectListBox()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
7 Add the following code for the LoadMultiSelectListBox
C private void LoadMultiSelectListBox()
try
thisErrorsDeleteAll()
((FileQueryConnection)thisDataConnections[Locations])Execute()
foreach (XPathNavigator navigator2 in
thisDataSources[Locations]CreateNavigator()SelectSingleNode(rs
data thisNamespaceManager)Select(zrow thisNamespaceManager))
thisAddMultiSelectReasons(navigator2)
if
(thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) =
null)
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])Delete
Self()
catch (Exception exception)
VB Private Sub LoadMultiSelectListBox()
Try
MeErrorsDeleteAll()
DirectCast(MeDataConnections(Locations)
FileQueryConnection)Execute()
For Each navigator2 As XPathNavigator In
MeDataSources(Locations)CreateNavigator()SelectSingleNode(rsda
ta MeNamespaceManager)[Select](zrow MeNamespaceManager)
MeAddMultiSelectReasons(navigator2)
Next
If
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) IsNot
Nothing Then
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])D
eleteSelf()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
Substitute the ldquoLocationsrdquo for the name of your data connection
8 Add the following code for the AddMultiSelectReasons
C private void AddMultiSelectReasons(XPathNavigator item)
try
thisErrorsDeleteAll()
XPathNavigator currentXPathNav =
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
XPathNavigator newSibling = null
if (currentXPathNav = null)
newSibling = currentXPathNavClone()
XPathNavigator navigator3 =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription thisNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
stringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = null
catch (Exception exception)
VB Private Sub AddMultiSelectReasons(item As XPathNavigator)
Try
MeErrorsDeleteAll()
Dim currentXPathNav As XPathNavigator =
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
Dim newSibling As XPathNavigator = Nothing
If currentXPathNav IsNot Nothing Then
newSibling = currentXPathNavClone()
End If
Dim navigator3 As XPathNavigator =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription MeNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
StringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = Nothing
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
9 Write the following code for GetCurrentXPathNav
C public XPathNavigator GetCurrentXPathNav(string XPath)
return
thisMainDataSourceCreateNavigator()SelectSingleNode(XPath
thisNamespaceManager)
VB Public Function GetCurrentXPathNav(XPath As String) As
XPathNavigator
Return
MeMainDataSourceCreateNavigator()SelectSingleNode(XPath
MeNamespaceManager)
End Function
10 To test the code click the debug run button in Visual Studio
Step 4 (optional) Write code-behind to ldquosaverdquo the selected checkboxes for
further processing You really donrsquot have to do this step because InfoPath will save the selections when the end user
clicks Save However you may need to save the selections to be used for something else such as
Neat trick to get the correct XPath
1 In the data source right-click on the item and select Copy XPath
2 Go to your code and paste the XPath
displaying the selections in the SharePoint list The following code will show how to write code to save
the selected items
1 Create an element off the root item to store the values In my example I will be calling it
selectedItems
2 Add the following code within the InternalStartup function
C EventManagerXmlEvents[mymyFieldsmyMultiSelectOptionsmyselectedO
ption]Changed += new XmlChangedEventHandler(selectedOption_Changed)
VB EventManagerXmlEvents(mymyFieldsmyMultiSelectOptionsmyselectedO
ption)Changed += New XmlChangedEventHandler(selectedOption_Changed)
3 Add the following code for the selectedOption_Changed event
C public void selectedOption_Changed(object sender XmlEventArgs e)
SaveMultiSelectListItems()
VB Public Sub selectedOption_Changed(sender As Object e As XmlEventArgs)
SaveMultiSelectListItems()
End Sub
4 Add the following code for the SaveMultiSelectLIstItems function
C private void SaveMultiSelectListItems()
try
thisErrorsDeleteAll()
XPathNodeIterator iterator =
thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSele
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
3 Format your table to your preference
Step 2 Create a data connection to the SharePoint list using owssvrdll Even though we can connect directly to a SharePoint list we canrsquot populate the ldquocheckboxesrdquo with the
list data because technically wersquore working with an XML structure thatrsquos simulating multiple
checkboxes What we need to do is retrieve the list data as an XML structure In order to do this we
will need to call the owssvrdll service
Before you use the owssvrdll server you will need the GUID of the list If you are also going to
reference a view of the list you will also need the GUID of the view
To get the GUID of the list
1 Select Settings ndash List Settings
The GUID will appear in the URL in the List query string parameter
Do the following with the GUID
Replace 7B with
Replace 2D with ndash
Replace 7D with
In our example the GUID will be 356671C3-DB57-4385-8F0E-0A3B991A6457
To get the GUID of the view
1 In the View drop-down field select the view you would like to use
2 In the View drop-down field select Modify this View
The GUID will appear in the URL in the View query string parameter
Do the following with the GUID
Replace 7B with
Replace 2D with ndash
Replace 7D with
In our example we wonrsquot be using the view
Once you have the GUIDs you are able to set up the data connections
1 Add a new data connection
2 Select Create a new connection to Receive data
1 Select XML Document for the source
2 In the location field enter the URL to the owssvrdll call
The generic URL is
http[url]_vti_binowssvrdllCmd=Displayamp[Parms]ampXMLDATA=TRUE
In our example wersquore only interested in using the List so the parameter that we will use is List
Here is the example URL that we will be using
httpmoss2007-dev8318_vti_binowssvrdllCmd=DisplayampList=356671C3-DB57-4385-8F0E-
0A3B991A6457ampXMLDATA=TRUE
If you would like further reading on this please view the appendix at the end of the documents
3 Select Access the data from the specified location Do not check Store a copy of the data for
offline use
4 Enter a user friendly name for the connection and click Finish Make sure that Automatically
retrieve data when form is opened is checked
Step 3 Write code-behind to automatically populate the checkboxes
Before you begin you may want to configure the form to determine
What language you will be using
Where you would like the code-behind project to reside
1 Select Tools ndash Form Options
2 Select Programming
3 Select your language from the Form template code language drop-down (C or Visual Basic)
4 Select the location for the code
Now you are ready to create code
5 From the main menu select Tools ndash Programming ndash Loading Event
If you have VSTA installed on your machine you will see the following similar screen Note that
your code may appear differently depending upon the language that you selected
6 Add the following code for the FormEvents_Loading event Remember to substitute
C public void FormEvents_Loading(object sender LoadingEventArgs e)
try
thisErrorsDeleteAll()
if
(thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSel
ectOptions thisNamespaceManager)Count lt= 1)
thisLoadMultiSelectListBox()
catch (Exception exception)
VB Public Sub FormEvents_Loading(sender As Object e As LoadingEventArgs)
Try
MeErrorsDeleteAll()
If
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)Count lt= 1 Then
MeLoadMultiSelectListBox()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
7 Add the following code for the LoadMultiSelectListBox
C private void LoadMultiSelectListBox()
try
thisErrorsDeleteAll()
((FileQueryConnection)thisDataConnections[Locations])Execute()
foreach (XPathNavigator navigator2 in
thisDataSources[Locations]CreateNavigator()SelectSingleNode(rs
data thisNamespaceManager)Select(zrow thisNamespaceManager))
thisAddMultiSelectReasons(navigator2)
if
(thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) =
null)
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])Delete
Self()
catch (Exception exception)
VB Private Sub LoadMultiSelectListBox()
Try
MeErrorsDeleteAll()
DirectCast(MeDataConnections(Locations)
FileQueryConnection)Execute()
For Each navigator2 As XPathNavigator In
MeDataSources(Locations)CreateNavigator()SelectSingleNode(rsda
ta MeNamespaceManager)[Select](zrow MeNamespaceManager)
MeAddMultiSelectReasons(navigator2)
Next
If
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) IsNot
Nothing Then
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])D
eleteSelf()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
Substitute the ldquoLocationsrdquo for the name of your data connection
8 Add the following code for the AddMultiSelectReasons
C private void AddMultiSelectReasons(XPathNavigator item)
try
thisErrorsDeleteAll()
XPathNavigator currentXPathNav =
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
XPathNavigator newSibling = null
if (currentXPathNav = null)
newSibling = currentXPathNavClone()
XPathNavigator navigator3 =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription thisNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
stringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = null
catch (Exception exception)
VB Private Sub AddMultiSelectReasons(item As XPathNavigator)
Try
MeErrorsDeleteAll()
Dim currentXPathNav As XPathNavigator =
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
Dim newSibling As XPathNavigator = Nothing
If currentXPathNav IsNot Nothing Then
newSibling = currentXPathNavClone()
End If
Dim navigator3 As XPathNavigator =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription MeNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
StringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = Nothing
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
9 Write the following code for GetCurrentXPathNav
C public XPathNavigator GetCurrentXPathNav(string XPath)
return
thisMainDataSourceCreateNavigator()SelectSingleNode(XPath
thisNamespaceManager)
VB Public Function GetCurrentXPathNav(XPath As String) As
XPathNavigator
Return
MeMainDataSourceCreateNavigator()SelectSingleNode(XPath
MeNamespaceManager)
End Function
10 To test the code click the debug run button in Visual Studio
Step 4 (optional) Write code-behind to ldquosaverdquo the selected checkboxes for
further processing You really donrsquot have to do this step because InfoPath will save the selections when the end user
clicks Save However you may need to save the selections to be used for something else such as
Neat trick to get the correct XPath
1 In the data source right-click on the item and select Copy XPath
2 Go to your code and paste the XPath
displaying the selections in the SharePoint list The following code will show how to write code to save
the selected items
1 Create an element off the root item to store the values In my example I will be calling it
selectedItems
2 Add the following code within the InternalStartup function
C EventManagerXmlEvents[mymyFieldsmyMultiSelectOptionsmyselectedO
ption]Changed += new XmlChangedEventHandler(selectedOption_Changed)
VB EventManagerXmlEvents(mymyFieldsmyMultiSelectOptionsmyselectedO
ption)Changed += New XmlChangedEventHandler(selectedOption_Changed)
3 Add the following code for the selectedOption_Changed event
C public void selectedOption_Changed(object sender XmlEventArgs e)
SaveMultiSelectListItems()
VB Public Sub selectedOption_Changed(sender As Object e As XmlEventArgs)
SaveMultiSelectListItems()
End Sub
4 Add the following code for the SaveMultiSelectLIstItems function
C private void SaveMultiSelectListItems()
try
thisErrorsDeleteAll()
XPathNodeIterator iterator =
thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSele
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
Do the following with the GUID
Replace 7B with
Replace 2D with ndash
Replace 7D with
In our example the GUID will be 356671C3-DB57-4385-8F0E-0A3B991A6457
To get the GUID of the view
1 In the View drop-down field select the view you would like to use
2 In the View drop-down field select Modify this View
The GUID will appear in the URL in the View query string parameter
Do the following with the GUID
Replace 7B with
Replace 2D with ndash
Replace 7D with
In our example we wonrsquot be using the view
Once you have the GUIDs you are able to set up the data connections
1 Add a new data connection
2 Select Create a new connection to Receive data
1 Select XML Document for the source
2 In the location field enter the URL to the owssvrdll call
The generic URL is
http[url]_vti_binowssvrdllCmd=Displayamp[Parms]ampXMLDATA=TRUE
In our example wersquore only interested in using the List so the parameter that we will use is List
Here is the example URL that we will be using
httpmoss2007-dev8318_vti_binowssvrdllCmd=DisplayampList=356671C3-DB57-4385-8F0E-
0A3B991A6457ampXMLDATA=TRUE
If you would like further reading on this please view the appendix at the end of the documents
3 Select Access the data from the specified location Do not check Store a copy of the data for
offline use
4 Enter a user friendly name for the connection and click Finish Make sure that Automatically
retrieve data when form is opened is checked
Step 3 Write code-behind to automatically populate the checkboxes
Before you begin you may want to configure the form to determine
What language you will be using
Where you would like the code-behind project to reside
1 Select Tools ndash Form Options
2 Select Programming
3 Select your language from the Form template code language drop-down (C or Visual Basic)
4 Select the location for the code
Now you are ready to create code
5 From the main menu select Tools ndash Programming ndash Loading Event
If you have VSTA installed on your machine you will see the following similar screen Note that
your code may appear differently depending upon the language that you selected
6 Add the following code for the FormEvents_Loading event Remember to substitute
C public void FormEvents_Loading(object sender LoadingEventArgs e)
try
thisErrorsDeleteAll()
if
(thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSel
ectOptions thisNamespaceManager)Count lt= 1)
thisLoadMultiSelectListBox()
catch (Exception exception)
VB Public Sub FormEvents_Loading(sender As Object e As LoadingEventArgs)
Try
MeErrorsDeleteAll()
If
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)Count lt= 1 Then
MeLoadMultiSelectListBox()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
7 Add the following code for the LoadMultiSelectListBox
C private void LoadMultiSelectListBox()
try
thisErrorsDeleteAll()
((FileQueryConnection)thisDataConnections[Locations])Execute()
foreach (XPathNavigator navigator2 in
thisDataSources[Locations]CreateNavigator()SelectSingleNode(rs
data thisNamespaceManager)Select(zrow thisNamespaceManager))
thisAddMultiSelectReasons(navigator2)
if
(thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) =
null)
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])Delete
Self()
catch (Exception exception)
VB Private Sub LoadMultiSelectListBox()
Try
MeErrorsDeleteAll()
DirectCast(MeDataConnections(Locations)
FileQueryConnection)Execute()
For Each navigator2 As XPathNavigator In
MeDataSources(Locations)CreateNavigator()SelectSingleNode(rsda
ta MeNamespaceManager)[Select](zrow MeNamespaceManager)
MeAddMultiSelectReasons(navigator2)
Next
If
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) IsNot
Nothing Then
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])D
eleteSelf()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
Substitute the ldquoLocationsrdquo for the name of your data connection
8 Add the following code for the AddMultiSelectReasons
C private void AddMultiSelectReasons(XPathNavigator item)
try
thisErrorsDeleteAll()
XPathNavigator currentXPathNav =
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
XPathNavigator newSibling = null
if (currentXPathNav = null)
newSibling = currentXPathNavClone()
XPathNavigator navigator3 =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription thisNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
stringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = null
catch (Exception exception)
VB Private Sub AddMultiSelectReasons(item As XPathNavigator)
Try
MeErrorsDeleteAll()
Dim currentXPathNav As XPathNavigator =
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
Dim newSibling As XPathNavigator = Nothing
If currentXPathNav IsNot Nothing Then
newSibling = currentXPathNavClone()
End If
Dim navigator3 As XPathNavigator =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription MeNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
StringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = Nothing
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
9 Write the following code for GetCurrentXPathNav
C public XPathNavigator GetCurrentXPathNav(string XPath)
return
thisMainDataSourceCreateNavigator()SelectSingleNode(XPath
thisNamespaceManager)
VB Public Function GetCurrentXPathNav(XPath As String) As
XPathNavigator
Return
MeMainDataSourceCreateNavigator()SelectSingleNode(XPath
MeNamespaceManager)
End Function
10 To test the code click the debug run button in Visual Studio
Step 4 (optional) Write code-behind to ldquosaverdquo the selected checkboxes for
further processing You really donrsquot have to do this step because InfoPath will save the selections when the end user
clicks Save However you may need to save the selections to be used for something else such as
Neat trick to get the correct XPath
1 In the data source right-click on the item and select Copy XPath
2 Go to your code and paste the XPath
displaying the selections in the SharePoint list The following code will show how to write code to save
the selected items
1 Create an element off the root item to store the values In my example I will be calling it
selectedItems
2 Add the following code within the InternalStartup function
C EventManagerXmlEvents[mymyFieldsmyMultiSelectOptionsmyselectedO
ption]Changed += new XmlChangedEventHandler(selectedOption_Changed)
VB EventManagerXmlEvents(mymyFieldsmyMultiSelectOptionsmyselectedO
ption)Changed += New XmlChangedEventHandler(selectedOption_Changed)
3 Add the following code for the selectedOption_Changed event
C public void selectedOption_Changed(object sender XmlEventArgs e)
SaveMultiSelectListItems()
VB Public Sub selectedOption_Changed(sender As Object e As XmlEventArgs)
SaveMultiSelectListItems()
End Sub
4 Add the following code for the SaveMultiSelectLIstItems function
C private void SaveMultiSelectListItems()
try
thisErrorsDeleteAll()
XPathNodeIterator iterator =
thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSele
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
Do the following with the GUID
Replace 7B with
Replace 2D with ndash
Replace 7D with
In our example we wonrsquot be using the view
Once you have the GUIDs you are able to set up the data connections
1 Add a new data connection
2 Select Create a new connection to Receive data
1 Select XML Document for the source
2 In the location field enter the URL to the owssvrdll call
The generic URL is
http[url]_vti_binowssvrdllCmd=Displayamp[Parms]ampXMLDATA=TRUE
In our example wersquore only interested in using the List so the parameter that we will use is List
Here is the example URL that we will be using
httpmoss2007-dev8318_vti_binowssvrdllCmd=DisplayampList=356671C3-DB57-4385-8F0E-
0A3B991A6457ampXMLDATA=TRUE
If you would like further reading on this please view the appendix at the end of the documents
3 Select Access the data from the specified location Do not check Store a copy of the data for
offline use
4 Enter a user friendly name for the connection and click Finish Make sure that Automatically
retrieve data when form is opened is checked
Step 3 Write code-behind to automatically populate the checkboxes
Before you begin you may want to configure the form to determine
What language you will be using
Where you would like the code-behind project to reside
1 Select Tools ndash Form Options
2 Select Programming
3 Select your language from the Form template code language drop-down (C or Visual Basic)
4 Select the location for the code
Now you are ready to create code
5 From the main menu select Tools ndash Programming ndash Loading Event
If you have VSTA installed on your machine you will see the following similar screen Note that
your code may appear differently depending upon the language that you selected
6 Add the following code for the FormEvents_Loading event Remember to substitute
C public void FormEvents_Loading(object sender LoadingEventArgs e)
try
thisErrorsDeleteAll()
if
(thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSel
ectOptions thisNamespaceManager)Count lt= 1)
thisLoadMultiSelectListBox()
catch (Exception exception)
VB Public Sub FormEvents_Loading(sender As Object e As LoadingEventArgs)
Try
MeErrorsDeleteAll()
If
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)Count lt= 1 Then
MeLoadMultiSelectListBox()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
7 Add the following code for the LoadMultiSelectListBox
C private void LoadMultiSelectListBox()
try
thisErrorsDeleteAll()
((FileQueryConnection)thisDataConnections[Locations])Execute()
foreach (XPathNavigator navigator2 in
thisDataSources[Locations]CreateNavigator()SelectSingleNode(rs
data thisNamespaceManager)Select(zrow thisNamespaceManager))
thisAddMultiSelectReasons(navigator2)
if
(thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) =
null)
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])Delete
Self()
catch (Exception exception)
VB Private Sub LoadMultiSelectListBox()
Try
MeErrorsDeleteAll()
DirectCast(MeDataConnections(Locations)
FileQueryConnection)Execute()
For Each navigator2 As XPathNavigator In
MeDataSources(Locations)CreateNavigator()SelectSingleNode(rsda
ta MeNamespaceManager)[Select](zrow MeNamespaceManager)
MeAddMultiSelectReasons(navigator2)
Next
If
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) IsNot
Nothing Then
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])D
eleteSelf()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
Substitute the ldquoLocationsrdquo for the name of your data connection
8 Add the following code for the AddMultiSelectReasons
C private void AddMultiSelectReasons(XPathNavigator item)
try
thisErrorsDeleteAll()
XPathNavigator currentXPathNav =
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
XPathNavigator newSibling = null
if (currentXPathNav = null)
newSibling = currentXPathNavClone()
XPathNavigator navigator3 =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription thisNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
stringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = null
catch (Exception exception)
VB Private Sub AddMultiSelectReasons(item As XPathNavigator)
Try
MeErrorsDeleteAll()
Dim currentXPathNav As XPathNavigator =
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
Dim newSibling As XPathNavigator = Nothing
If currentXPathNav IsNot Nothing Then
newSibling = currentXPathNavClone()
End If
Dim navigator3 As XPathNavigator =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription MeNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
StringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = Nothing
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
9 Write the following code for GetCurrentXPathNav
C public XPathNavigator GetCurrentXPathNav(string XPath)
return
thisMainDataSourceCreateNavigator()SelectSingleNode(XPath
thisNamespaceManager)
VB Public Function GetCurrentXPathNav(XPath As String) As
XPathNavigator
Return
MeMainDataSourceCreateNavigator()SelectSingleNode(XPath
MeNamespaceManager)
End Function
10 To test the code click the debug run button in Visual Studio
Step 4 (optional) Write code-behind to ldquosaverdquo the selected checkboxes for
further processing You really donrsquot have to do this step because InfoPath will save the selections when the end user
clicks Save However you may need to save the selections to be used for something else such as
Neat trick to get the correct XPath
1 In the data source right-click on the item and select Copy XPath
2 Go to your code and paste the XPath
displaying the selections in the SharePoint list The following code will show how to write code to save
the selected items
1 Create an element off the root item to store the values In my example I will be calling it
selectedItems
2 Add the following code within the InternalStartup function
C EventManagerXmlEvents[mymyFieldsmyMultiSelectOptionsmyselectedO
ption]Changed += new XmlChangedEventHandler(selectedOption_Changed)
VB EventManagerXmlEvents(mymyFieldsmyMultiSelectOptionsmyselectedO
ption)Changed += New XmlChangedEventHandler(selectedOption_Changed)
3 Add the following code for the selectedOption_Changed event
C public void selectedOption_Changed(object sender XmlEventArgs e)
SaveMultiSelectListItems()
VB Public Sub selectedOption_Changed(sender As Object e As XmlEventArgs)
SaveMultiSelectListItems()
End Sub
4 Add the following code for the SaveMultiSelectLIstItems function
C private void SaveMultiSelectListItems()
try
thisErrorsDeleteAll()
XPathNodeIterator iterator =
thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSele
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
1 Select XML Document for the source
2 In the location field enter the URL to the owssvrdll call
The generic URL is
http[url]_vti_binowssvrdllCmd=Displayamp[Parms]ampXMLDATA=TRUE
In our example wersquore only interested in using the List so the parameter that we will use is List
Here is the example URL that we will be using
httpmoss2007-dev8318_vti_binowssvrdllCmd=DisplayampList=356671C3-DB57-4385-8F0E-
0A3B991A6457ampXMLDATA=TRUE
If you would like further reading on this please view the appendix at the end of the documents
3 Select Access the data from the specified location Do not check Store a copy of the data for
offline use
4 Enter a user friendly name for the connection and click Finish Make sure that Automatically
retrieve data when form is opened is checked
Step 3 Write code-behind to automatically populate the checkboxes
Before you begin you may want to configure the form to determine
What language you will be using
Where you would like the code-behind project to reside
1 Select Tools ndash Form Options
2 Select Programming
3 Select your language from the Form template code language drop-down (C or Visual Basic)
4 Select the location for the code
Now you are ready to create code
5 From the main menu select Tools ndash Programming ndash Loading Event
If you have VSTA installed on your machine you will see the following similar screen Note that
your code may appear differently depending upon the language that you selected
6 Add the following code for the FormEvents_Loading event Remember to substitute
C public void FormEvents_Loading(object sender LoadingEventArgs e)
try
thisErrorsDeleteAll()
if
(thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSel
ectOptions thisNamespaceManager)Count lt= 1)
thisLoadMultiSelectListBox()
catch (Exception exception)
VB Public Sub FormEvents_Loading(sender As Object e As LoadingEventArgs)
Try
MeErrorsDeleteAll()
If
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)Count lt= 1 Then
MeLoadMultiSelectListBox()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
7 Add the following code for the LoadMultiSelectListBox
C private void LoadMultiSelectListBox()
try
thisErrorsDeleteAll()
((FileQueryConnection)thisDataConnections[Locations])Execute()
foreach (XPathNavigator navigator2 in
thisDataSources[Locations]CreateNavigator()SelectSingleNode(rs
data thisNamespaceManager)Select(zrow thisNamespaceManager))
thisAddMultiSelectReasons(navigator2)
if
(thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) =
null)
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])Delete
Self()
catch (Exception exception)
VB Private Sub LoadMultiSelectListBox()
Try
MeErrorsDeleteAll()
DirectCast(MeDataConnections(Locations)
FileQueryConnection)Execute()
For Each navigator2 As XPathNavigator In
MeDataSources(Locations)CreateNavigator()SelectSingleNode(rsda
ta MeNamespaceManager)[Select](zrow MeNamespaceManager)
MeAddMultiSelectReasons(navigator2)
Next
If
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) IsNot
Nothing Then
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])D
eleteSelf()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
Substitute the ldquoLocationsrdquo for the name of your data connection
8 Add the following code for the AddMultiSelectReasons
C private void AddMultiSelectReasons(XPathNavigator item)
try
thisErrorsDeleteAll()
XPathNavigator currentXPathNav =
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
XPathNavigator newSibling = null
if (currentXPathNav = null)
newSibling = currentXPathNavClone()
XPathNavigator navigator3 =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription thisNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
stringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = null
catch (Exception exception)
VB Private Sub AddMultiSelectReasons(item As XPathNavigator)
Try
MeErrorsDeleteAll()
Dim currentXPathNav As XPathNavigator =
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
Dim newSibling As XPathNavigator = Nothing
If currentXPathNav IsNot Nothing Then
newSibling = currentXPathNavClone()
End If
Dim navigator3 As XPathNavigator =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription MeNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
StringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = Nothing
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
9 Write the following code for GetCurrentXPathNav
C public XPathNavigator GetCurrentXPathNav(string XPath)
return
thisMainDataSourceCreateNavigator()SelectSingleNode(XPath
thisNamespaceManager)
VB Public Function GetCurrentXPathNav(XPath As String) As
XPathNavigator
Return
MeMainDataSourceCreateNavigator()SelectSingleNode(XPath
MeNamespaceManager)
End Function
10 To test the code click the debug run button in Visual Studio
Step 4 (optional) Write code-behind to ldquosaverdquo the selected checkboxes for
further processing You really donrsquot have to do this step because InfoPath will save the selections when the end user
clicks Save However you may need to save the selections to be used for something else such as
Neat trick to get the correct XPath
1 In the data source right-click on the item and select Copy XPath
2 Go to your code and paste the XPath
displaying the selections in the SharePoint list The following code will show how to write code to save
the selected items
1 Create an element off the root item to store the values In my example I will be calling it
selectedItems
2 Add the following code within the InternalStartup function
C EventManagerXmlEvents[mymyFieldsmyMultiSelectOptionsmyselectedO
ption]Changed += new XmlChangedEventHandler(selectedOption_Changed)
VB EventManagerXmlEvents(mymyFieldsmyMultiSelectOptionsmyselectedO
ption)Changed += New XmlChangedEventHandler(selectedOption_Changed)
3 Add the following code for the selectedOption_Changed event
C public void selectedOption_Changed(object sender XmlEventArgs e)
SaveMultiSelectListItems()
VB Public Sub selectedOption_Changed(sender As Object e As XmlEventArgs)
SaveMultiSelectListItems()
End Sub
4 Add the following code for the SaveMultiSelectLIstItems function
C private void SaveMultiSelectListItems()
try
thisErrorsDeleteAll()
XPathNodeIterator iterator =
thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSele
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
2 In the location field enter the URL to the owssvrdll call
The generic URL is
http[url]_vti_binowssvrdllCmd=Displayamp[Parms]ampXMLDATA=TRUE
In our example wersquore only interested in using the List so the parameter that we will use is List
Here is the example URL that we will be using
httpmoss2007-dev8318_vti_binowssvrdllCmd=DisplayampList=356671C3-DB57-4385-8F0E-
0A3B991A6457ampXMLDATA=TRUE
If you would like further reading on this please view the appendix at the end of the documents
3 Select Access the data from the specified location Do not check Store a copy of the data for
offline use
4 Enter a user friendly name for the connection and click Finish Make sure that Automatically
retrieve data when form is opened is checked
Step 3 Write code-behind to automatically populate the checkboxes
Before you begin you may want to configure the form to determine
What language you will be using
Where you would like the code-behind project to reside
1 Select Tools ndash Form Options
2 Select Programming
3 Select your language from the Form template code language drop-down (C or Visual Basic)
4 Select the location for the code
Now you are ready to create code
5 From the main menu select Tools ndash Programming ndash Loading Event
If you have VSTA installed on your machine you will see the following similar screen Note that
your code may appear differently depending upon the language that you selected
6 Add the following code for the FormEvents_Loading event Remember to substitute
C public void FormEvents_Loading(object sender LoadingEventArgs e)
try
thisErrorsDeleteAll()
if
(thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSel
ectOptions thisNamespaceManager)Count lt= 1)
thisLoadMultiSelectListBox()
catch (Exception exception)
VB Public Sub FormEvents_Loading(sender As Object e As LoadingEventArgs)
Try
MeErrorsDeleteAll()
If
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)Count lt= 1 Then
MeLoadMultiSelectListBox()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
7 Add the following code for the LoadMultiSelectListBox
C private void LoadMultiSelectListBox()
try
thisErrorsDeleteAll()
((FileQueryConnection)thisDataConnections[Locations])Execute()
foreach (XPathNavigator navigator2 in
thisDataSources[Locations]CreateNavigator()SelectSingleNode(rs
data thisNamespaceManager)Select(zrow thisNamespaceManager))
thisAddMultiSelectReasons(navigator2)
if
(thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) =
null)
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])Delete
Self()
catch (Exception exception)
VB Private Sub LoadMultiSelectListBox()
Try
MeErrorsDeleteAll()
DirectCast(MeDataConnections(Locations)
FileQueryConnection)Execute()
For Each navigator2 As XPathNavigator In
MeDataSources(Locations)CreateNavigator()SelectSingleNode(rsda
ta MeNamespaceManager)[Select](zrow MeNamespaceManager)
MeAddMultiSelectReasons(navigator2)
Next
If
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) IsNot
Nothing Then
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])D
eleteSelf()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
Substitute the ldquoLocationsrdquo for the name of your data connection
8 Add the following code for the AddMultiSelectReasons
C private void AddMultiSelectReasons(XPathNavigator item)
try
thisErrorsDeleteAll()
XPathNavigator currentXPathNav =
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
XPathNavigator newSibling = null
if (currentXPathNav = null)
newSibling = currentXPathNavClone()
XPathNavigator navigator3 =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription thisNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
stringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = null
catch (Exception exception)
VB Private Sub AddMultiSelectReasons(item As XPathNavigator)
Try
MeErrorsDeleteAll()
Dim currentXPathNav As XPathNavigator =
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
Dim newSibling As XPathNavigator = Nothing
If currentXPathNav IsNot Nothing Then
newSibling = currentXPathNavClone()
End If
Dim navigator3 As XPathNavigator =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription MeNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
StringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = Nothing
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
9 Write the following code for GetCurrentXPathNav
C public XPathNavigator GetCurrentXPathNav(string XPath)
return
thisMainDataSourceCreateNavigator()SelectSingleNode(XPath
thisNamespaceManager)
VB Public Function GetCurrentXPathNav(XPath As String) As
XPathNavigator
Return
MeMainDataSourceCreateNavigator()SelectSingleNode(XPath
MeNamespaceManager)
End Function
10 To test the code click the debug run button in Visual Studio
Step 4 (optional) Write code-behind to ldquosaverdquo the selected checkboxes for
further processing You really donrsquot have to do this step because InfoPath will save the selections when the end user
clicks Save However you may need to save the selections to be used for something else such as
Neat trick to get the correct XPath
1 In the data source right-click on the item and select Copy XPath
2 Go to your code and paste the XPath
displaying the selections in the SharePoint list The following code will show how to write code to save
the selected items
1 Create an element off the root item to store the values In my example I will be calling it
selectedItems
2 Add the following code within the InternalStartup function
C EventManagerXmlEvents[mymyFieldsmyMultiSelectOptionsmyselectedO
ption]Changed += new XmlChangedEventHandler(selectedOption_Changed)
VB EventManagerXmlEvents(mymyFieldsmyMultiSelectOptionsmyselectedO
ption)Changed += New XmlChangedEventHandler(selectedOption_Changed)
3 Add the following code for the selectedOption_Changed event
C public void selectedOption_Changed(object sender XmlEventArgs e)
SaveMultiSelectListItems()
VB Public Sub selectedOption_Changed(sender As Object e As XmlEventArgs)
SaveMultiSelectListItems()
End Sub
4 Add the following code for the SaveMultiSelectLIstItems function
C private void SaveMultiSelectListItems()
try
thisErrorsDeleteAll()
XPathNodeIterator iterator =
thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSele
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
Step 3 Write code-behind to automatically populate the checkboxes
Before you begin you may want to configure the form to determine
What language you will be using
Where you would like the code-behind project to reside
1 Select Tools ndash Form Options
2 Select Programming
3 Select your language from the Form template code language drop-down (C or Visual Basic)
4 Select the location for the code
Now you are ready to create code
5 From the main menu select Tools ndash Programming ndash Loading Event
If you have VSTA installed on your machine you will see the following similar screen Note that
your code may appear differently depending upon the language that you selected
6 Add the following code for the FormEvents_Loading event Remember to substitute
C public void FormEvents_Loading(object sender LoadingEventArgs e)
try
thisErrorsDeleteAll()
if
(thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSel
ectOptions thisNamespaceManager)Count lt= 1)
thisLoadMultiSelectListBox()
catch (Exception exception)
VB Public Sub FormEvents_Loading(sender As Object e As LoadingEventArgs)
Try
MeErrorsDeleteAll()
If
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)Count lt= 1 Then
MeLoadMultiSelectListBox()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
7 Add the following code for the LoadMultiSelectListBox
C private void LoadMultiSelectListBox()
try
thisErrorsDeleteAll()
((FileQueryConnection)thisDataConnections[Locations])Execute()
foreach (XPathNavigator navigator2 in
thisDataSources[Locations]CreateNavigator()SelectSingleNode(rs
data thisNamespaceManager)Select(zrow thisNamespaceManager))
thisAddMultiSelectReasons(navigator2)
if
(thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) =
null)
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])Delete
Self()
catch (Exception exception)
VB Private Sub LoadMultiSelectListBox()
Try
MeErrorsDeleteAll()
DirectCast(MeDataConnections(Locations)
FileQueryConnection)Execute()
For Each navigator2 As XPathNavigator In
MeDataSources(Locations)CreateNavigator()SelectSingleNode(rsda
ta MeNamespaceManager)[Select](zrow MeNamespaceManager)
MeAddMultiSelectReasons(navigator2)
Next
If
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) IsNot
Nothing Then
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])D
eleteSelf()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
Substitute the ldquoLocationsrdquo for the name of your data connection
8 Add the following code for the AddMultiSelectReasons
C private void AddMultiSelectReasons(XPathNavigator item)
try
thisErrorsDeleteAll()
XPathNavigator currentXPathNav =
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
XPathNavigator newSibling = null
if (currentXPathNav = null)
newSibling = currentXPathNavClone()
XPathNavigator navigator3 =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription thisNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
stringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = null
catch (Exception exception)
VB Private Sub AddMultiSelectReasons(item As XPathNavigator)
Try
MeErrorsDeleteAll()
Dim currentXPathNav As XPathNavigator =
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
Dim newSibling As XPathNavigator = Nothing
If currentXPathNav IsNot Nothing Then
newSibling = currentXPathNavClone()
End If
Dim navigator3 As XPathNavigator =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription MeNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
StringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = Nothing
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
9 Write the following code for GetCurrentXPathNav
C public XPathNavigator GetCurrentXPathNav(string XPath)
return
thisMainDataSourceCreateNavigator()SelectSingleNode(XPath
thisNamespaceManager)
VB Public Function GetCurrentXPathNav(XPath As String) As
XPathNavigator
Return
MeMainDataSourceCreateNavigator()SelectSingleNode(XPath
MeNamespaceManager)
End Function
10 To test the code click the debug run button in Visual Studio
Step 4 (optional) Write code-behind to ldquosaverdquo the selected checkboxes for
further processing You really donrsquot have to do this step because InfoPath will save the selections when the end user
clicks Save However you may need to save the selections to be used for something else such as
Neat trick to get the correct XPath
1 In the data source right-click on the item and select Copy XPath
2 Go to your code and paste the XPath
displaying the selections in the SharePoint list The following code will show how to write code to save
the selected items
1 Create an element off the root item to store the values In my example I will be calling it
selectedItems
2 Add the following code within the InternalStartup function
C EventManagerXmlEvents[mymyFieldsmyMultiSelectOptionsmyselectedO
ption]Changed += new XmlChangedEventHandler(selectedOption_Changed)
VB EventManagerXmlEvents(mymyFieldsmyMultiSelectOptionsmyselectedO
ption)Changed += New XmlChangedEventHandler(selectedOption_Changed)
3 Add the following code for the selectedOption_Changed event
C public void selectedOption_Changed(object sender XmlEventArgs e)
SaveMultiSelectListItems()
VB Public Sub selectedOption_Changed(sender As Object e As XmlEventArgs)
SaveMultiSelectListItems()
End Sub
4 Add the following code for the SaveMultiSelectLIstItems function
C private void SaveMultiSelectListItems()
try
thisErrorsDeleteAll()
XPathNodeIterator iterator =
thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSele
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
3 Select your language from the Form template code language drop-down (C or Visual Basic)
4 Select the location for the code
Now you are ready to create code
5 From the main menu select Tools ndash Programming ndash Loading Event
If you have VSTA installed on your machine you will see the following similar screen Note that
your code may appear differently depending upon the language that you selected
6 Add the following code for the FormEvents_Loading event Remember to substitute
C public void FormEvents_Loading(object sender LoadingEventArgs e)
try
thisErrorsDeleteAll()
if
(thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSel
ectOptions thisNamespaceManager)Count lt= 1)
thisLoadMultiSelectListBox()
catch (Exception exception)
VB Public Sub FormEvents_Loading(sender As Object e As LoadingEventArgs)
Try
MeErrorsDeleteAll()
If
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)Count lt= 1 Then
MeLoadMultiSelectListBox()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
7 Add the following code for the LoadMultiSelectListBox
C private void LoadMultiSelectListBox()
try
thisErrorsDeleteAll()
((FileQueryConnection)thisDataConnections[Locations])Execute()
foreach (XPathNavigator navigator2 in
thisDataSources[Locations]CreateNavigator()SelectSingleNode(rs
data thisNamespaceManager)Select(zrow thisNamespaceManager))
thisAddMultiSelectReasons(navigator2)
if
(thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) =
null)
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])Delete
Self()
catch (Exception exception)
VB Private Sub LoadMultiSelectListBox()
Try
MeErrorsDeleteAll()
DirectCast(MeDataConnections(Locations)
FileQueryConnection)Execute()
For Each navigator2 As XPathNavigator In
MeDataSources(Locations)CreateNavigator()SelectSingleNode(rsda
ta MeNamespaceManager)[Select](zrow MeNamespaceManager)
MeAddMultiSelectReasons(navigator2)
Next
If
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) IsNot
Nothing Then
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])D
eleteSelf()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
Substitute the ldquoLocationsrdquo for the name of your data connection
8 Add the following code for the AddMultiSelectReasons
C private void AddMultiSelectReasons(XPathNavigator item)
try
thisErrorsDeleteAll()
XPathNavigator currentXPathNav =
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
XPathNavigator newSibling = null
if (currentXPathNav = null)
newSibling = currentXPathNavClone()
XPathNavigator navigator3 =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription thisNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
stringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = null
catch (Exception exception)
VB Private Sub AddMultiSelectReasons(item As XPathNavigator)
Try
MeErrorsDeleteAll()
Dim currentXPathNav As XPathNavigator =
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
Dim newSibling As XPathNavigator = Nothing
If currentXPathNav IsNot Nothing Then
newSibling = currentXPathNavClone()
End If
Dim navigator3 As XPathNavigator =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription MeNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
StringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = Nothing
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
9 Write the following code for GetCurrentXPathNav
C public XPathNavigator GetCurrentXPathNav(string XPath)
return
thisMainDataSourceCreateNavigator()SelectSingleNode(XPath
thisNamespaceManager)
VB Public Function GetCurrentXPathNav(XPath As String) As
XPathNavigator
Return
MeMainDataSourceCreateNavigator()SelectSingleNode(XPath
MeNamespaceManager)
End Function
10 To test the code click the debug run button in Visual Studio
Step 4 (optional) Write code-behind to ldquosaverdquo the selected checkboxes for
further processing You really donrsquot have to do this step because InfoPath will save the selections when the end user
clicks Save However you may need to save the selections to be used for something else such as
Neat trick to get the correct XPath
1 In the data source right-click on the item and select Copy XPath
2 Go to your code and paste the XPath
displaying the selections in the SharePoint list The following code will show how to write code to save
the selected items
1 Create an element off the root item to store the values In my example I will be calling it
selectedItems
2 Add the following code within the InternalStartup function
C EventManagerXmlEvents[mymyFieldsmyMultiSelectOptionsmyselectedO
ption]Changed += new XmlChangedEventHandler(selectedOption_Changed)
VB EventManagerXmlEvents(mymyFieldsmyMultiSelectOptionsmyselectedO
ption)Changed += New XmlChangedEventHandler(selectedOption_Changed)
3 Add the following code for the selectedOption_Changed event
C public void selectedOption_Changed(object sender XmlEventArgs e)
SaveMultiSelectListItems()
VB Public Sub selectedOption_Changed(sender As Object e As XmlEventArgs)
SaveMultiSelectListItems()
End Sub
4 Add the following code for the SaveMultiSelectLIstItems function
C private void SaveMultiSelectListItems()
try
thisErrorsDeleteAll()
XPathNodeIterator iterator =
thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSele
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
6 Add the following code for the FormEvents_Loading event Remember to substitute
C public void FormEvents_Loading(object sender LoadingEventArgs e)
try
thisErrorsDeleteAll()
if
(thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSel
ectOptions thisNamespaceManager)Count lt= 1)
thisLoadMultiSelectListBox()
catch (Exception exception)
VB Public Sub FormEvents_Loading(sender As Object e As LoadingEventArgs)
Try
MeErrorsDeleteAll()
If
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)Count lt= 1 Then
MeLoadMultiSelectListBox()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
7 Add the following code for the LoadMultiSelectListBox
C private void LoadMultiSelectListBox()
try
thisErrorsDeleteAll()
((FileQueryConnection)thisDataConnections[Locations])Execute()
foreach (XPathNavigator navigator2 in
thisDataSources[Locations]CreateNavigator()SelectSingleNode(rs
data thisNamespaceManager)Select(zrow thisNamespaceManager))
thisAddMultiSelectReasons(navigator2)
if
(thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) =
null)
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])Delete
Self()
catch (Exception exception)
VB Private Sub LoadMultiSelectListBox()
Try
MeErrorsDeleteAll()
DirectCast(MeDataConnections(Locations)
FileQueryConnection)Execute()
For Each navigator2 As XPathNavigator In
MeDataSources(Locations)CreateNavigator()SelectSingleNode(rsda
ta MeNamespaceManager)[Select](zrow MeNamespaceManager)
MeAddMultiSelectReasons(navigator2)
Next
If
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) IsNot
Nothing Then
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])D
eleteSelf()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
Substitute the ldquoLocationsrdquo for the name of your data connection
8 Add the following code for the AddMultiSelectReasons
C private void AddMultiSelectReasons(XPathNavigator item)
try
thisErrorsDeleteAll()
XPathNavigator currentXPathNav =
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
XPathNavigator newSibling = null
if (currentXPathNav = null)
newSibling = currentXPathNavClone()
XPathNavigator navigator3 =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription thisNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
stringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = null
catch (Exception exception)
VB Private Sub AddMultiSelectReasons(item As XPathNavigator)
Try
MeErrorsDeleteAll()
Dim currentXPathNav As XPathNavigator =
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
Dim newSibling As XPathNavigator = Nothing
If currentXPathNav IsNot Nothing Then
newSibling = currentXPathNavClone()
End If
Dim navigator3 As XPathNavigator =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription MeNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
StringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = Nothing
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
9 Write the following code for GetCurrentXPathNav
C public XPathNavigator GetCurrentXPathNav(string XPath)
return
thisMainDataSourceCreateNavigator()SelectSingleNode(XPath
thisNamespaceManager)
VB Public Function GetCurrentXPathNav(XPath As String) As
XPathNavigator
Return
MeMainDataSourceCreateNavigator()SelectSingleNode(XPath
MeNamespaceManager)
End Function
10 To test the code click the debug run button in Visual Studio
Step 4 (optional) Write code-behind to ldquosaverdquo the selected checkboxes for
further processing You really donrsquot have to do this step because InfoPath will save the selections when the end user
clicks Save However you may need to save the selections to be used for something else such as
Neat trick to get the correct XPath
1 In the data source right-click on the item and select Copy XPath
2 Go to your code and paste the XPath
displaying the selections in the SharePoint list The following code will show how to write code to save
the selected items
1 Create an element off the root item to store the values In my example I will be calling it
selectedItems
2 Add the following code within the InternalStartup function
C EventManagerXmlEvents[mymyFieldsmyMultiSelectOptionsmyselectedO
ption]Changed += new XmlChangedEventHandler(selectedOption_Changed)
VB EventManagerXmlEvents(mymyFieldsmyMultiSelectOptionsmyselectedO
ption)Changed += New XmlChangedEventHandler(selectedOption_Changed)
3 Add the following code for the selectedOption_Changed event
C public void selectedOption_Changed(object sender XmlEventArgs e)
SaveMultiSelectListItems()
VB Public Sub selectedOption_Changed(sender As Object e As XmlEventArgs)
SaveMultiSelectListItems()
End Sub
4 Add the following code for the SaveMultiSelectLIstItems function
C private void SaveMultiSelectListItems()
try
thisErrorsDeleteAll()
XPathNodeIterator iterator =
thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSele
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
7 Add the following code for the LoadMultiSelectListBox
C private void LoadMultiSelectListBox()
try
thisErrorsDeleteAll()
((FileQueryConnection)thisDataConnections[Locations])Execute()
foreach (XPathNavigator navigator2 in
thisDataSources[Locations]CreateNavigator()SelectSingleNode(rs
data thisNamespaceManager)Select(zrow thisNamespaceManager))
thisAddMultiSelectReasons(navigator2)
if
(thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) =
null)
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])Delete
Self()
catch (Exception exception)
VB Private Sub LoadMultiSelectListBox()
Try
MeErrorsDeleteAll()
DirectCast(MeDataConnections(Locations)
FileQueryConnection)Execute()
For Each navigator2 As XPathNavigator In
MeDataSources(Locations)CreateNavigator()SelectSingleNode(rsda
ta MeNamespaceManager)[Select](zrow MeNamespaceManager)
MeAddMultiSelectReasons(navigator2)
Next
If
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1]) IsNot
Nothing Then
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions[1])D
eleteSelf()
End If
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
Substitute the ldquoLocationsrdquo for the name of your data connection
8 Add the following code for the AddMultiSelectReasons
C private void AddMultiSelectReasons(XPathNavigator item)
try
thisErrorsDeleteAll()
XPathNavigator currentXPathNav =
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
XPathNavigator newSibling = null
if (currentXPathNav = null)
newSibling = currentXPathNavClone()
XPathNavigator navigator3 =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription thisNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
stringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = null
catch (Exception exception)
VB Private Sub AddMultiSelectReasons(item As XPathNavigator)
Try
MeErrorsDeleteAll()
Dim currentXPathNav As XPathNavigator =
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
Dim newSibling As XPathNavigator = Nothing
If currentXPathNav IsNot Nothing Then
newSibling = currentXPathNavClone()
End If
Dim navigator3 As XPathNavigator =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription MeNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
StringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = Nothing
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
9 Write the following code for GetCurrentXPathNav
C public XPathNavigator GetCurrentXPathNav(string XPath)
return
thisMainDataSourceCreateNavigator()SelectSingleNode(XPath
thisNamespaceManager)
VB Public Function GetCurrentXPathNav(XPath As String) As
XPathNavigator
Return
MeMainDataSourceCreateNavigator()SelectSingleNode(XPath
MeNamespaceManager)
End Function
10 To test the code click the debug run button in Visual Studio
Step 4 (optional) Write code-behind to ldquosaverdquo the selected checkboxes for
further processing You really donrsquot have to do this step because InfoPath will save the selections when the end user
clicks Save However you may need to save the selections to be used for something else such as
Neat trick to get the correct XPath
1 In the data source right-click on the item and select Copy XPath
2 Go to your code and paste the XPath
displaying the selections in the SharePoint list The following code will show how to write code to save
the selected items
1 Create an element off the root item to store the values In my example I will be calling it
selectedItems
2 Add the following code within the InternalStartup function
C EventManagerXmlEvents[mymyFieldsmyMultiSelectOptionsmyselectedO
ption]Changed += new XmlChangedEventHandler(selectedOption_Changed)
VB EventManagerXmlEvents(mymyFieldsmyMultiSelectOptionsmyselectedO
ption)Changed += New XmlChangedEventHandler(selectedOption_Changed)
3 Add the following code for the selectedOption_Changed event
C public void selectedOption_Changed(object sender XmlEventArgs e)
SaveMultiSelectListItems()
VB Public Sub selectedOption_Changed(sender As Object e As XmlEventArgs)
SaveMultiSelectListItems()
End Sub
4 Add the following code for the SaveMultiSelectLIstItems function
C private void SaveMultiSelectListItems()
try
thisErrorsDeleteAll()
XPathNodeIterator iterator =
thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSele
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
Substitute the ldquoLocationsrdquo for the name of your data connection
8 Add the following code for the AddMultiSelectReasons
C private void AddMultiSelectReasons(XPathNavigator item)
try
thisErrorsDeleteAll()
XPathNavigator currentXPathNav =
thisGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
XPathNavigator newSibling = null
if (currentXPathNav = null)
newSibling = currentXPathNavClone()
XPathNavigator navigator3 =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription thisNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
stringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = null
catch (Exception exception)
VB Private Sub AddMultiSelectReasons(item As XPathNavigator)
Try
MeErrorsDeleteAll()
Dim currentXPathNav As XPathNavigator =
MeGetCurrentXPathNav(mymyFieldsmyMultiSelectOptions)
Dim newSibling As XPathNavigator = Nothing
If currentXPathNav IsNot Nothing Then
newSibling = currentXPathNavClone()
End If
Dim navigator3 As XPathNavigator =
newSiblingSelectSingleNode(mymyFieldsmyMultiSelectOptionsmyopti
onDescription MeNamespaceManager)
navigator3SetValue(itemGetAttribute(ows_LinkTitle
StringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = Nothing
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
9 Write the following code for GetCurrentXPathNav
C public XPathNavigator GetCurrentXPathNav(string XPath)
return
thisMainDataSourceCreateNavigator()SelectSingleNode(XPath
thisNamespaceManager)
VB Public Function GetCurrentXPathNav(XPath As String) As
XPathNavigator
Return
MeMainDataSourceCreateNavigator()SelectSingleNode(XPath
MeNamespaceManager)
End Function
10 To test the code click the debug run button in Visual Studio
Step 4 (optional) Write code-behind to ldquosaverdquo the selected checkboxes for
further processing You really donrsquot have to do this step because InfoPath will save the selections when the end user
clicks Save However you may need to save the selections to be used for something else such as
Neat trick to get the correct XPath
1 In the data source right-click on the item and select Copy XPath
2 Go to your code and paste the XPath
displaying the selections in the SharePoint list The following code will show how to write code to save
the selected items
1 Create an element off the root item to store the values In my example I will be calling it
selectedItems
2 Add the following code within the InternalStartup function
C EventManagerXmlEvents[mymyFieldsmyMultiSelectOptionsmyselectedO
ption]Changed += new XmlChangedEventHandler(selectedOption_Changed)
VB EventManagerXmlEvents(mymyFieldsmyMultiSelectOptionsmyselectedO
ption)Changed += New XmlChangedEventHandler(selectedOption_Changed)
3 Add the following code for the selectedOption_Changed event
C public void selectedOption_Changed(object sender XmlEventArgs e)
SaveMultiSelectListItems()
VB Public Sub selectedOption_Changed(sender As Object e As XmlEventArgs)
SaveMultiSelectListItems()
End Sub
4 Add the following code for the SaveMultiSelectLIstItems function
C private void SaveMultiSelectListItems()
try
thisErrorsDeleteAll()
XPathNodeIterator iterator =
thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSele
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
navigator3SetValue(itemGetAttribute(ows_LinkTitle
StringEmpty))
currentXPathNavInsertAfter(newSibling)
newSibling = Nothing
Catch exception As Exception
End Try
End Sub
NOTE
Substitute mymyFieldsmyMultiSelectOptions with the XPath of the
MultiSelectedOptions on your document
9 Write the following code for GetCurrentXPathNav
C public XPathNavigator GetCurrentXPathNav(string XPath)
return
thisMainDataSourceCreateNavigator()SelectSingleNode(XPath
thisNamespaceManager)
VB Public Function GetCurrentXPathNav(XPath As String) As
XPathNavigator
Return
MeMainDataSourceCreateNavigator()SelectSingleNode(XPath
MeNamespaceManager)
End Function
10 To test the code click the debug run button in Visual Studio
Step 4 (optional) Write code-behind to ldquosaverdquo the selected checkboxes for
further processing You really donrsquot have to do this step because InfoPath will save the selections when the end user
clicks Save However you may need to save the selections to be used for something else such as
Neat trick to get the correct XPath
1 In the data source right-click on the item and select Copy XPath
2 Go to your code and paste the XPath
displaying the selections in the SharePoint list The following code will show how to write code to save
the selected items
1 Create an element off the root item to store the values In my example I will be calling it
selectedItems
2 Add the following code within the InternalStartup function
C EventManagerXmlEvents[mymyFieldsmyMultiSelectOptionsmyselectedO
ption]Changed += new XmlChangedEventHandler(selectedOption_Changed)
VB EventManagerXmlEvents(mymyFieldsmyMultiSelectOptionsmyselectedO
ption)Changed += New XmlChangedEventHandler(selectedOption_Changed)
3 Add the following code for the selectedOption_Changed event
C public void selectedOption_Changed(object sender XmlEventArgs e)
SaveMultiSelectListItems()
VB Public Sub selectedOption_Changed(sender As Object e As XmlEventArgs)
SaveMultiSelectListItems()
End Sub
4 Add the following code for the SaveMultiSelectLIstItems function
C private void SaveMultiSelectListItems()
try
thisErrorsDeleteAll()
XPathNodeIterator iterator =
thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSele
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
Step 4 (optional) Write code-behind to ldquosaverdquo the selected checkboxes for
further processing You really donrsquot have to do this step because InfoPath will save the selections when the end user
clicks Save However you may need to save the selections to be used for something else such as
Neat trick to get the correct XPath
1 In the data source right-click on the item and select Copy XPath
2 Go to your code and paste the XPath
displaying the selections in the SharePoint list The following code will show how to write code to save
the selected items
1 Create an element off the root item to store the values In my example I will be calling it
selectedItems
2 Add the following code within the InternalStartup function
C EventManagerXmlEvents[mymyFieldsmyMultiSelectOptionsmyselectedO
ption]Changed += new XmlChangedEventHandler(selectedOption_Changed)
VB EventManagerXmlEvents(mymyFieldsmyMultiSelectOptionsmyselectedO
ption)Changed += New XmlChangedEventHandler(selectedOption_Changed)
3 Add the following code for the selectedOption_Changed event
C public void selectedOption_Changed(object sender XmlEventArgs e)
SaveMultiSelectListItems()
VB Public Sub selectedOption_Changed(sender As Object e As XmlEventArgs)
SaveMultiSelectListItems()
End Sub
4 Add the following code for the SaveMultiSelectLIstItems function
C private void SaveMultiSelectListItems()
try
thisErrorsDeleteAll()
XPathNodeIterator iterator =
thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSele
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
displaying the selections in the SharePoint list The following code will show how to write code to save
the selected items
1 Create an element off the root item to store the values In my example I will be calling it
selectedItems
2 Add the following code within the InternalStartup function
C EventManagerXmlEvents[mymyFieldsmyMultiSelectOptionsmyselectedO
ption]Changed += new XmlChangedEventHandler(selectedOption_Changed)
VB EventManagerXmlEvents(mymyFieldsmyMultiSelectOptionsmyselectedO
ption)Changed += New XmlChangedEventHandler(selectedOption_Changed)
3 Add the following code for the selectedOption_Changed event
C public void selectedOption_Changed(object sender XmlEventArgs e)
SaveMultiSelectListItems()
VB Public Sub selectedOption_Changed(sender As Object e As XmlEventArgs)
SaveMultiSelectListItems()
End Sub
4 Add the following code for the SaveMultiSelectLIstItems function
C private void SaveMultiSelectListItems()
try
thisErrorsDeleteAll()
XPathNodeIterator iterator =
thisMainDataSourceCreateNavigator()Select(mymyFieldsmyMultiSele
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
ctOptions thisNamespaceManager)
string str = stringEmpty
SystemTextStringBuilder builder = new
SystemTextStringBuilder(stringEmpty)
int num = 0
while (iteratorMoveNext())
if
(boolParse(iteratorCurrentSelectSingleNode(myselectedOption
thisNamespaceManager)Value))
if (num == 0)
builderAppend(iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
thisNamespaceManager)Value)
num++
str = stringEmpty
thisGetCurrentXPathNav(mymyFieldsmyselectedItems)SetValue(build
erToString())
catch (Exception exception)
VB Private Sub SaveMultiSelectListItems()
Try
MeErrorsDeleteAll()
Dim iterator As XPathNodeIterator =
MeMainDataSourceCreateNavigator()[Select](mymyFieldsmyMul
tiSelectOptions MeNamespaceManager)
Dim str As String = StringEmpty
Dim builder As New
SystemTextStringBuilder(StringEmpty)
Dim num As Integer = 0
While iteratorMoveNext()
If
BooleanParse(iteratorCurrentSelectSingleNode(myselectedOptio
n MeNamespaceManager)Value) Then
If num = 0 Then
builderAppend(iteratorCurrentSelectSingleNode(myoption
Description MeNamespaceManager)Value)
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
Else
builderAppend( +
iteratorCurrentSelectSingleNode(myoptionDescription
MeNamespaceManager)Value)
End If
num += 1
End If
str = StringEmpty
End While
MeGetCurrentXPathNav(mymyFieldsmyselectedItems)SetV
alue(builderToString())
Catch exception As Exception
End Try
End Sub
5 Save your code
Step 5 Publishing the form to SharePoint 1 Select Publish Form Template form the Tasks list
2 For the publish location select To a SharePoint server with or without InfoPath Forms
Services and click Next
3 In the location enter your site URL and click Next
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
4 The only option that you can select is Administrator-approved form template Click Next
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
5 In the Specify a location and file name for the form template enter a local path on your
machine thatrsquos not the same path as where the InfoPath form is located In our example
wersquore working off a directory called Cplayground We will put the document in
Cplaygroundpublished
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
6 If you want to add some columns to the SharePoint list every time an end-user saves the
doc add the columns Otherwise click Next
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
7 Click Publish
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
When you get a successful message click Close
Now you have to publish your template
1 Open Central Administration
2 Select Application Management
3 Under InfoPath Forms Services select Manage Form Templates
4 Click Upload Form Template
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
5 Select the location where you published your form and click Upload
6 Once the template is uploaded hover over the file until you see the drop-down
7 From the drop-down select Activate to a Site Collection
8 In the Activation Location select the site and click OK after the site has been selected
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
Step 6 Implementing the form on a SharePoint form library 1 Select the form library to use this form In our example the form library will be called Inventory
2 From the form library select Settings - Form Library Settings
3 Under General Settings select Advanced Settings
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
4 For the Content Types field select Yes for Allow management of content types and click OK
Before clicking OK you may want to set Browser-enabled Documents select Display as a Web
page
5 Under the Content Types section select Add from existing site types
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
6 From the Available Site Content Types select your new type and click Add Then click OK
7 Under Content Types select Change new button order and default content type
8 For the Form type uncheck the Visible button and click OK
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
VOILA
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
APPENDIX (Source httpwwwsynergyonlinecomblogblog-mossListsPostsPostaspxID=24)
9182008
Exploiting the value of OWSSVRDLL in SharePoint 30
Randy Williams
Ever since v1 of SharePoint Team Services Microsoft has used OWSSVRDLL to remotely invoke
functions against SharePoint With the incorporation of Web Services in v2 this need is partly
deprecated and even more so in v3 Nonetheless OWSSVRDLL is still around and still plays an
important role with external applications such as SharePoint Designer It is part of FP-RPC (Front Page ndash
Remote Procedure Call) but should not be confused with Front Page extensions
Knowing this nifty utility can provide you a number commands for your developer tool bag Here are
some examples Irsquove come up with on how it can be used
1 Returning all data for a SharePoint list including its XSD
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampQuery=ampXMLDATA=TRUE
2 Or how about just returning all data for a SharePoint list but based on a specific view from the list
httpWebApp[site]_vti_binowssvrdllCmd=DisplayampList=ListGuidampView=ViewGuidampXMLDATA=TR
UE
The response for a simple view looks like this
ltxml xmlnss=uuidBDC6E3F0-6DA3-11d1-A2A3-00AA00C14882
xmlnsdt=uuidC2F41010-65B3-11d1-A29F-00AA00C14882
xmlnsrs=urnschemas-microsoft-comrowset
xmlnsz=RowsetSchemagt
ltsSchema id=RowsetSchemagt
ltsElementType name=row content=eltOnly rsCommandTimeout=30gt
ltsAttributeType name=ows_City rsname=City rsnumber=1gt
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
ltsdatatype dttype=string dtmaxLength=512 gt
ltsAttributeTypegt
ltsAttributeType name=ows_ID rsname=ID rsnumber=2gt
ltsdatatype dttype=i4 dtmaxLength=4 gt
ltsAttributeTypegt
ltsElementTypegt
ltsSchemagt
ltrsdatagt
ltzrow ows_City=Berlin ows_ID=1 gt
ltzrow ows_City=Paris ows_ID=2 gt
ltzrow ows_City=Honolulu ows_ID=3 gt
ltzrow ows_City=Munich ows_ID=4 gt
ltzrow ows_City=Bordeaux ows_ID=5 gt
ltzrow ows_City=New York City ows_ID=6 gt
ltrsdatagt
ltxmlgt
Either of these two could be useful for consuming in an XML Web Part or from any external application
that can make HTTP requests and process XML output This includes the browser using XMLHTTP
technology as covered in this article The example covered in this blog discusses how to consume the
XML output in an InfoPath form Clever
3 Aside from returning XML data you can also get definition information For example you can return
the CAML-based definition of a list This can be real handy at times especially if you are creating your
own list definitions You can create the list using the UI and then scrape its definition this way
httpWebApp[site]_vti_binowssvrdllCmd=ExportListampList=ListGuid
4 How about getting the ONETXML (site definition) that was used to create a web site
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchema
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well
5 And finally Irsquom not sure how this is helpful but you could return all of the field types registered into
SharePoint
httpWebApp[site]_vti_binowssvrdllCmd=GetProjSchemaampSiteTemplate=fldtypes
As you can see there are a number of practical and interesting ways of using this DLL Irsquove found it
useful for just extracting structure and content out of a SharePoint environment and consuming this data
from within applications There are a few more commands that you can also try but Irsquove chosen to not list
them here You can learn more about it from this blog httpmsdnmicrosoftcomen-
uslibraryms478653aspx This article isnrsquot dated but I suspect much of it was pulled over from STS v2
as many of the commands no longer work in WSS 30
With that have fun and let me know what other uses you can find for the output
Notes
1 This command will respect your SharePoint security So any clients that call into it will need to be
authenticated by the defined provider and object specific permissions are in force
2 Some of the querystring parameters such as XMLDATA are case sensitive If you follow the syntax
above exactly you shouldnrsquot have any problems
3 You may have noticed that in some places you must supply a GUID In case you didnrsquot know you can
easily extract these using the SharePoint UI For example if you go to the settings page for any list
(_layoutslisteditaspx) you can extract the List GUID from the querystring If you edit the view for a list
you can also get the viewrsquos GUID as well