August 2005 - Posts

How To Create a Hyperlink to SharePoint's List Export to Spreadsheet
22 August 05 01:27 PM | wkriebel | 7 comment(s)
Because you can't copy the hyperlink on the "Export to spreadsheet" link on SharePoint lists, here is how you can create your own hyperlink.

http://[Server]/[Site]/([Subsite]/)_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List=[ListGUID]&View=[ViewGUID]&CacheControl=1

Replace the [Placeholders] with your environment's information.  A handy way to get the list and view GUIDs is to go into "Modify Columns and Settings" then scoll down to the views section and click on the view that you want to use.  You will notice the escaped list and view GUIDs in the resultant URL.

Here is an example:

http://MyWSS/sites/samplesite/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List=%7BD109453A%2D1A6E%2D4F83%2DAFF9%2DCCA04A75D76D%7D&View=%7B8FB21A2F%2DB62C%2D41D8%2DBA0C%2D7BD9C31FAA51%7D&CacheControl=1

See also, MSDN's article: URL Protocol and my article: How To Add a Hyperlink To a SharePoint Event Outlook Export

Launch an InfoPath form from a SharePoint page
09 August 05 05:12 PM | wkriebel | 1 comment(s)

Here is a handy piece of sample code that can be used within a SharePoint web page as JScript that will launch an InfoPath form without using the Open/Save dialog (which sometimes causes users to download the XSN file onto their computer).  Users will still get a security prompt, which you can disable with policy if this is for intranet usage.

function LaunchInfoPath(templateURL,saveLocation)
{
//savelocation sample: "http://server/site/document library/" or "file://c:"
//templateURL sample: "http://server/site/form library/forms/template.xsn"
//The function teturns true if it worked, false if it didn't


var infopath = new ActiveXObject("SharePoint.OpenXMLDocuments.1");
var result= infopath.CreateNewDocument2(window, templateURL,saveLocation);
return result;
}

By the way, no warranty is expressed or implied here. This code is just a sample. Your mileage may vary.
Filed under:
More Posts