戰地連結︰ Home My Flickr NBA.com About

顯示包含「SharePoint Server 2007」標籤的文章。顯示所有文章
顯示包含「SharePoint Server 2007」標籤的文章。顯示所有文章

2010年2月25日星期四

Viewing detailed Workflow history list (Hidden List)

Overview

When writing MOSS 2007 Workflow, you can log events (e.g. Log exceptions detail for debugging) to workflow history, which can be view in the task item page.

However, the task item page only shows simplified version of workflow history item. To view detailed workflow history list. You will have to enter the URL of the hidden list, in the format shown below:
http://[servername]/[sitename]/lists/Workflow%20History

For example if your site’s default page is:

http://servername/sites/sitename/default.aspx

then the detailed workflow history list URL will be:

http://servername/sites/sitename/lists/Workflow%20History

2008年12月11日星期四

Using custom workflow for SharePoint page approval (web content management)

Overview

SharePoint provides a out-of-the-box mechanism for Web Content Management (WCM) in document library (for example: a page author must seek web master approval before his page can be viewed by publish). But sometimes we may want to use our custom workflow for the approval process, and indeed it is possible to do so with SharePoint "workflow settings".

Reference

  1. Content Approval Workflow in MOSS 2007
  2. Customizing the pages approval for MOSS 2007 web content management

2008年9月8日星期一

"Page is customized" in SPD 2007

Overview

I come across a situation that the "Edit Page" menu item is missing for certain page in a SharePoint Site. Later I found that it is caused by "Customized Page" created by SharePoint Designer (SPD).
If want to enable the "Edit Page" function of customized page, you can navigate to the page in SPD, right-click on it and select "Reset to Site Definition". However, this action will remove the customized page content.
Links below talk more about "customized page", "customized files" in WSS 3.0 & MOSS 2007

Reference

  1. Understanding and Creating Customized and Uncustomized Files in Windows SharePoint Services 3.0
  2. Reset a customized page to the site definition
  3. 關於 SharePoint Designer 的利與弊

2008年9月5日星期五

Delete users from a Site collection

Overview

A user might belongs to many user groups in a MOSS site collection. Below steps show how to remove users from all groups of a site collection.

Reference

Removing Selected Users in MOSS 2007/WSS v3

Steps

  1. Select "Site Actions" -> "Site Settings"
  2. Click "People and groups" under "Users and Permission"
  3. In "People and Groups" page, click "All People"
  4. Select the users you want to remove, then select "Actions" -> "Delete Users from Site collection"

2008年9月4日星期四

Save MOSS sub sites as a template

Overview

Site templates are very useful when creating sites with similar structure & settings. However the link "Save site as template" is only available under Look and Feel at the Top Level of the site collection. So can I create site template of my sub site? Yes, and the way to do it is indeed quite simple.

Reference

MOSS 2007 - Save site as a template missing

Steps

  1. Navigate to the site you want to create site template.
  2. Copy its URL (e.g. "http://www.abc.com/demo/default.aspx")
  3. Change the URL to "http://www.abc.com/demo/_layout/savetmpl.aspx", this will lead you to the "Create site template" page.

2008年9月1日星期一

Silverlight + SharePoint integration (Silverlight Blueprint for SharePoint)

Overview

Microsoft provides a Blueprint for integrating Silverlight 2 applications with SharePoint sites. The Blueprint includes guides to configure SharePoint runtime environment for hosting Silverlight 2 application, as well as VS 2008 development environment for building Silverlight 2 wrapper webparts. Besides, 5 examples application are included in the Blueprint.

Reference

Silverlight Blueprint for SharePoint Beta 2

Steps

Below only briefly shows the steps required for the integration, for details please refer to Silverlight Blueprint Guidance.

Configure VS 2008 development environment

  1. Install the Microsoft Silverlight 2 Beta 2 plug-in
  2. Install VS 2008 SP1 and .NET Framework 3.5 SP1
  3. Install Microsoft Silverlight 2 Tools Beta 2 for VS 2008
  4. Install Windows SharePoint Services 3.0 Tools: VS 2008 Extensions

Configure SharePoint runtime environment

  1. Install Service Pack 1 for your SharePoint (either WSS 3.0 or MOSS 2007)
  2. Deploy System.Web.Silverlight.dll into Global Assembly Cache
  3. Add a new MIME type for (.xap) file to the IIS Web Application hosting SharePoint Sites
  4. Modify the web.config file of the IIS Web Application hosting SharePoint Sites to enable ASP.NET AJAX 1.0 and Silverlight 2 applications.

2008年7月30日星期三

Renaming a SharePoint 2007 / WSS 3.0 Server

Overview

Sometimes you have to rename a Server, it can easily be done in "System properties". However, if the Server host a SharePoint Services/Server, then renaming will cause SharePoint sites to stop functioning. Eventually I found a Blog showing the steps to rename a SharePoint 2007 / WSS 3.0 Server, and I have repost the steps below.

Reference

Renaming a SharePoint 2007 / WSS 3.0 Server (I copy the steps from here)

Rename a stand-alone server (Office SharePoint Server)

Steps

Change each alternate access mapping for your MOSS/WSS deployment in Central Administration

  1. Open Central Administration
  2. Click on the "Operation" Tab
  3. Click on the "Alternate access mappings" link under the "Global Configuration" heading
  4. Modify each mapping item to reflect your newly chosen server name, making sure to keep port numbers the same (this also include the mapping for Central Administration, don’t worry it's cool)

Use stsadm.exe to invoke the "renameserver" command option

  1. Open a command prompt window and navigate to the folder where stsadm.exe sits. Normally "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN".
  2. Use the "renameserver" command as follows, replacing and with the new and old names of your server:

    stsadm -o renameserver -newservername <newname> -oldservername <oldname>

Rename your Server via Change Name Operation in Windows Server 2003

  1. Now the last step is to simply right click on My Computer
  2. Open “Properties”
  3. Click on “Computer Name” tab
  4. Click “Change” button
  5. Input your new server name and reboot the server

Use stsadm.exe to invoke the "updatefarmcredentials" command option

  1. Open a command prompt window and navigate to the folder where stsadm.exe sits. Normally “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN”.
  2. Type in the following command and press [enter]:

    stsadm -o updatefarmcredentials -identitytype NetworkService

2008年6月26日星期四

My struggle with Browser enabled InfoPath Form connection to 'UserProfileService' Web Service

Overview

I faced a silly error when trying to use data connection in a Browser-enabled InfoPath Form to connect to MOSS built-in 'UserProfileService' web service in order to retrieve the display name (Preferred Name) of the logged in user. It works great without any error when I preview the form in InfoPath. However, I keep seeing the "ID 5566" error after I published the form to a document library and open it in browser. On the other hand, the published form works to show the current logged in user of the computer (not the MOSS portal) when opened in a client application (i.e. InfoPath).

Symptom

  1. Fail with "ID 5566" error when the form is opened in web browser.
  2. Work without error when opened in preview mode or in client application, shows the logged in user of the computer.
  3. Fail to work with all methods in 'UserProfileService' web service.

Cause

After many googling and trial & error, I still can't find the cause. Or I actually overlooked one suggestion in a post. That is the "Allow Anonymous login" option. I thought that this is the option in "Central Administration" -> "Application Management" -> "Authentication Providers" -> "Edit Authentication". But actually the main problem is at IIS settings of the web applications' authentication.

Reference

InfoPath - Get the current user without writing code

Steps to disable "anonymous login" in "IIS Manager"

  1. In Windows Server 2003 R2, click "Start" -> "Administrative Tools" -> "Internet Information Services (IIS) Manger"
  2. In "IIS Manager", expand the name of your computer on the left pane, expand "Web Sites"
  3. Right click on the web application you want to edit (e.g. mine is "SharePoint - 80", select "Properties"
  4. In "Properties", select "Directory Security" tab. Press "Edit" in the "Authentication and access control" category
  5. Uncheck "Enable anonymous access" in "Authentication Methods", click "OK" to go back to IIS Manager

2008年6月19日星期四

Deploy old SQL Reporting Services Reports to SharePoint Site

Overview

In my previous post, I discussed about how to setup SharePoint Integrated SQL Server Reporting Services (RS). Now that I have the Integrated RS ready, I can deploy the reports to the SharePoint site. But wait, how can I deploy a Pre-SP2 RS report to SharePoint site? Below shows the steps I used.

My RS reports consists of two files: a Report Definition file (.rdl) and a Data Source file (.rds). To deploy a Pre-SP2 RS report to a SharePoint site, I have to upload the Report Definition file, and create a new SP2 Data Source file (with extension changed to : .rsds).

Reference

  1. Deploying Reports, Models, and Shared Data Sources to a SharePoint Site
  2. How to: Create and Manage Shared Data Sources (SharePoint Integrated Mode)
  3. How to: Add Report Server Content Types to a Library (SharePoint Integrated Mode)

Steps

Upload Report Definition file

  1. Create a New Document Library (or use an existing one) in SharePoint site to store the Report Definition file and the Data Source file.
  2. Upload the Report Definition file (.rdl) of your report to the Document Library created in Step 1.

Add "Report Data Source" Content Type to the Document Library

  1. Before we can "New" a Data Source in SharePoint Document Library, we must first add the "Report Data Source" Content Type.
  2. Navigate to the Document Library, select "Settings" -> "Document Library Settings"
  3. Select "Advanced Settings"
  4. Select "Yes" for "Allow management of content types", click "OK"
  5. At "Document Library Settings", select "Add from existing site content types" under "Content Types" Category
  6. Make sure that "All Groups" is selected for "Select site content types from:", then select "Report Data Source" Content Type and click "Add"
  7. Click "OK"

Create a Data Source file in Document Library

  1. Navigate to the Document Library, select "New" -> "Report Data Source"
  2. Fill in the properties of the Data Source, I opened my old data source in visual studio and copy all the properties to the new one.
  3. Click "OK"

Bind the Report Definition file to the new Data Source

  1. Navigate to the Document Library, click to display the drop-down list of the Report Definition (.rdl) File
  2. Select "Manage Data Sources" in the drop-down list
  3. Click on the name of the Data Source to edit it.
  4. Specify the URL of the newly created Data Source (.rsds) file in "Data Source Link" and click "OK"
  5. Click "Close" to go back to Document Library, click on the Report Definition file to see the result. If a report is displayed successfully, then the deployment is done!

2008年6月18日星期三

Guides on setting up SharePoint integrated SQL Server Reporting Services

Overview

This is going to be a long post, in this post I am trying to describe how I setup Integrated SQL Server Reporting Services on a Standalone SharePoint Server. According to my understanding, these steps can be applied to SharePoint Services too.

Software Configuration

  • SQL Server 2005
  • SharePoint Server 2007
  • Microsoft .NET Framework 3.0 Download

Reference

Guides to install and configure

  1. How to: Configure SharePoint Integration on a Stand-alone Server
  2. Configuring Reporting Services for SharePoint 3.0 Integration
  3. How to: Create a Report Server Database for SharePoint Integrated Mode (Reporting Services Configuration)
  4. How to: Configure the Report Server Integration Feature in SharePoint Central Administration

Information on MOSS integrated SQL Server Reporting Service

  1. Microsoft SQL Server 2005 SP2 Reporting Services integration with WSS 3.0 and MOSS 2007
  2. Installation and Configuration Guide for SQL Server Reporting Services - SharePoint Integration Mode (Word format)

Steps

Prepare the software package

  1. SQL Server 2005 Service Pack 2 Download
  2. SQL Server 2005 Reporting Services Add-in for Microsoft SharePoint Technologies Download

Install software package

  1. Install .NET Framework 3.0 (My server originally has this installed)
  2. Install SQL Server 2005 SP 2
  3. Install SQL Server 2005 RS Add-in for SharePoint

Create a Report Server DB for SharePoint Integrated Mode (Check Reference 3 for details)

  1. Go to "Report Services Configuration" in SQL Server 2005 "Configuration Tools"
  2. Connect to the Instance you want to create the Report Server (Mine is "MSSQLSERVER")
  3. Click "Database Setup" on the left pane, then select the Server you want to connect and click "Connect"
  4. Click "New" button next to the Database Name.
  5. In "SQL Server Connection" dialog box, enter the name for the new Database, make sure to select the "Create the report server database in SharePoint Integrated mode" check box.
  6. Click "OK"
  7. On the Database Setup page, specify the Credential you want to connect to the report server, Click "Apply"

Configure Report Server Integration Feature in SharePoint Central Administration (Check Reference 4 for details)

  1. Go to "SharePoint 3.0 Central Administration"
  2. In Central Administration, select "Application Management", then click "Manage integration settings" under "Reporting Services"
  3. Specify the "Report Server URL" and "Authentication Mode", normally the Report Server URL will be something like "http://server-name:8080/reportserver" where port number should follow your configuration but not always "8080". I use "Trusted Account" for "Authentication Mode"
  4. Click "OK" to go back to "Application Management", then select "Grant database access".
  5. Specify the "Server Name" and "Instance" of the Report Server (In standalone case the server name should be the same as the SharePoint Server).
  6. In the pop up windows, specify the "User Name" and "Password" to connect to report server. Enter the administrator account here. Then click "OK" twice to go back to "Application Management".
  7. Select "Set server defaults", if you enter this page successfully, then it means that SharePoint connect to report server successfully. Actually I didn't change any settings here, and the report service works fine in SharePoint Site.

2008年6月4日星期三

Customizing Web Parts Outlook with XSL Editor

Overview

Out-of-the-box web parts in MOSS is very useful in development. However some of their looking might not fit your needs. However, the looking and style of web parts can be customized by editing the XSL(Extensible Stylesheet Language) file.

Steps

  1. Navigate to the Page containing the Web part you want to customize.
  2. Choose "Site Actions" -> "Edit Page"
  3. At the title of Web part, click "edit" -> "Modify Shared Web Part"
  4. At the Web part Tool Pane just opened on the right, under the "Data View Properties" category, click the "XSL Editor..." button to open a text editor containing XSL of the Web part.
  5. As the so called "XSL Editor" is just a very simple text editor (without Search Function), better copy the XSL inside to Visual Studio for editing. To do this, just new a file in VS and select XSLT as the template.
  6. When you finish editing the XSL in VS, copy it back into the "XSL Editor" and press "Save", then click "Apply" in the Web part Tool Pane to see the change.

2008年6月3日星期二

Embed SQL DB connection ID & password into BDC Definition File

Overview

(From MSDN: BDC Overview) Business Data Catalog (BDC) is a new business integration feature in Microsoft Office SharePoint Server 2007, it enables Office SharePoint Server 2007 to surface business data from back-end server applications without any coding.

Business Data Catalog provides built-in support for displaying data from databases and Web services. That is, you can use Business Data Catalog to display data from your SAP, Siebel, or other line-of-business (LOB) application via Web services or databases.

Water-blowing

(By me) BDC is a very good tool in connecting SharePoint with other system (DB or Web Services), it is good because the information collected from BDC application can be displayed in some out-of-the-box (but not good looking...) webparts, and be searched just like other information in SharePoint (Yes~ you can search your BDC connected DB in SharePoint!), you can also make site columns based on BDC information and embed it into content type too! One example is to make a SharePoint generated Word Document able to crawl data from DB thru BDC, quite amazing....

Besides all these exciting features, writing a BDC application is quite a pain in the xxx (Sorry I can't control myself for this). The Microsoft claimed "NO CODE" experience is equivalent to writing a XML file with several hundred to thousands of lines. This infernal XML file is called (Application Definition File).

Connecting to DB in BDC - SSO

Writing the damn Definition File is one thing, getting your application to connect to remote DB is another mountain to climb. I used to get it work by using Single Sign-On in MOSS, which is VERY difficult to setup, and required the server to be connected to an Active Directory.

Recently I come across this method to embed connection UserID and Password into the Definition File, so no more SSO nightmare~~ (This method is obviously NOT the best practice and should be used in development environment ONLY)

Code Snippet

<Property Name="DatabaseAccessProvider" Type="Microsoft.Office.Server.ApplicationRegistry.SystemSpecific.Db.DbAccessProvider">SqlServer</Property>

<Property Name="AuthenticationMode" Type="Microsoft.Office.Server.ApplicationRegistry.SystemSpecific.Db.DbAuthenticationMode">PassThrough</Property>

<Property Name="rdbconnection Data Source" Type="System.String">ServerName_Here</Property>

<Property Name="rdbconnection Initial Catalog" Type="System.String">DataBaseName_Here</Property>

<Property Name="rdbconnection Integrated Security" Type="System.String">SSPI</Property>

<Property Name="RdbConnection Pooling" Type="System.String">false</Property>

<!--For Passing Login & Password Directly-->

<Property Name="RdbConnection User ID" Type="System.String">UserID Here</Property>

<Property Name="RdbConnection Password" Type="System.String">Password Here</Property>

<Property Name="RdbConnection Trusted_Connection" Type="System.String">false</Property>

In the above Code Snippet, actually what you have to customize is "ServerName", "DataBaseName", "UserID" & "Password", and the authentication should work.

Note that I am using SQL Authentication here, so make sure to SQL Server you are connecting to have SQL Authentication enabled and have a matching UserID and Password.

2008年5月30日星期五

Using Features and Solutions to do Deployment in MOSS / WSS

Overview

"Feature" is a new concept in MOSS / WSS 3.0, it defines a collection of functionality or site customization in a SharePoint site (For example, adding "Content Type", "Columns" or "Workflow"). Feature can be installed into a specific server machine, and then be activated or deactivated on specific sites.

A Feature must consists of a definition file (Feature.xml), plus any number of manifest files in XML format. Location of manifest files is specified in <ElementManifests></ElementManifests> tags in "Feature.xml" file.

"Solution" is used as a mean to deploy custom code, files and other components to SharePoint. With the Solution Framework, developers can deploy custom components such as Web Parts, Features, site definitions and templates, custom code access security (CAS) policies, and add assemblies to a specific SharePoint site's BIN directory or to the global assembly cache (GAC).

Each Solution contains one solution file, called a Windows SharePoint Package (WSP) file, which is essentially a cabinet (*.cab) file with (*.wsp) extension.

Reference

Creating a Custom Feature in Office SharePoint Server 2007

Creating a Solution

2008年5月20日星期二

Working with InfoPath Repeatable Table/Section in MOSS workflows

Overview

With an InfoPath form as a workflow list item, we can gain access to its data via workflowProperties.Item. However, there is no native support in MOSS workflows for repeating table/sections. So we developers have to write custom helper method to gain this function.

Reference

Julie's Office Dev Blog : InfoPath 2007, SharePoint Workflows and Whatnot

Code Snippet

Parse repeating data in an InfoPath form (normally this is the submit form)
This code is copied form "MOSS SDK Workflow Example - Inter-System Purchase Order" by Microsoft

    1 private void GetLineItemsFromOrder(out DateTime dueDate, out LineItem[] items)

    2 {

    3     List<LineItem> LineItems = new List<LineItem>();

    4 

    5     //Load the bytes for the document

    6     byte[] xmlBytes = this.workflowProperties.Item.File.OpenBinary();

    7 

    8     //Remove the BOM from the xml file so XmlDocument Can handle it

    9     string Xml = System.Text.Encoding.UTF8.GetString(xmlBytes);//, 1, xmlBytes.Length - 1);

   10     if (Xml[0] == (char)0xfeff)

   11     {

   12         Xml = Xml.Substring(1);

   13     }

   14 

   15     XmlDocument Document = new XmlDocument();

   16     Document.LoadXml(Xml);

   17 

   18     XmlElement RootElement = Document.DocumentElement;

   19 

   20     XmlNamespaceManager Manager = new XmlNamespaceManager(Document.NameTable);

   21     Manager.AddNamespace("my", RootElement.NamespaceURI);

   22 

   23     //Get Due Date

   24     dueDate = DateTime.Parse(RootElement.SelectSingleNode("//my:ShipBy", Manager).InnerText);

   25 

   26     //Get Order Details

   27     XmlNodeList OrderItems = RootElement.SelectNodes("//my:OrderItem", Manager);

   28     foreach(XmlNode OrderItem in OrderItems)

   29     {

   30         LineItem LineItem = new LineItem();

   31         LineItem.ProductID = OrderItem.SelectSingleNode("my:ProductID", Manager).InnerText;

   32         LineItem.Quantity = OrderItem.SelectSingleNode("my:Quantity", Manager).InnerText;

   33         LineItems.Add(LineItem);

   34     }

   35 

   36     items = LineItems.ToArray();

   37 

   38 }

Passing repeating data to an InfoPath task form
In MOSS workflows, InfoPath task form is receiving data by setting up a secondary data source bound to a "ItemMetadata.xml" file. Unfortunately, repeating data schema is not supported in this file.

In this example, I will try to send the data in original list item file to the InfoPath task form, I am sending over the actual xml of the original list item file as a string value in the ItemMetadata. To get the actual xml of the original list item file, we can use the code snippet extracted from above example:

//Load the bytes for the document

byte[] xmlBytes = this.workflowProperties.Item.File.OpenBinary();

 

//Remove the BOM from the xml file so XmlDocument Can handle it

string Xml = System.Text.Encoding.UTF8.GetString(xmlBytes);//, 1, xmlBytes.Length - 1);

if (Xml[0] == (char)0xfeff)

{

    Xml = Xml.Substring(1);

}

 

Here we get the string variable "Xml" as the xml of the original list item file, and we can pass it to ItemMetadata. Next step is to parse this xml string into repeating data in the InfoPath task form, to do this, we have to write custom code in the InfoPath task form, will require the form to be "Fully Trust". The code snippet of the task form is as below:

public void FormEvents_Loading(object sender, LoadingEventArgs e)

{

    string xmlSource = this.DataSources["ItemMetadata"].CreateNavigator().SelectSingleNode("/z:row/@ows_repeatData", NamespaceManager).Value;

 

    XmlDocument nodeDoc = new XmlDocument();

    nodeDoc.LoadXml(xmlSource);

    XPathNavigator sectionNode = this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields", NamespaceManager);

    string ns = sectionNode.NamespaceURI;

 

    //we need to delete the default one Infopath adds in

    this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:repeatDetail", NamespaceManager).DeleteSelf();

 

    foreach (XmlNode thisNode in nodeDoc.DocumentElement.ChildNodes)

    {

        if ((thisNode.LocalName == "repeatDetail"))

        {

            //Start populating the data

            XmlWriter write = sectionNode.AppendChild();

            write.WriteStartElement("my", "repeatDetail", ns);

            write.WriteElementString("my", "DataColumn1", ns, "Value1");

            write.WriteElementString("my", "DataColumn2", ns, "Value2");

            write.WriteElementString("my", "DataColumn3", ns, "Value3");

            write.WriteElementString("my", "DataColumn4", ns, "Value4");

            write.WriteEndElement();

            write.Close();

        }

    }

}  

2008年5月19日星期一

Adding Workflow Task Link in Auto-generated Email

Overview

Sending Email is a common activity in MOSS workflows. When alerting the task assignee to finish the task, it is quite a normal thought to include the Workflow Task Link in the Email. Below is how to do this.

Reference

Task URL in workflows..

Code Snippet

    1 private string returnTaskUrls(string taskId)

    2 {

    3     //Use this to return the relevant URL's for use in e-mail of tasks.

    4     string weburl = workflowProperties.WebUrl;

    5     string taskUrl = "/_layouts/WrkTaskIP.aspx?List=";

    6     string listId = workflowProperties.TaskListId.ToString();

    7     string fulltaskUrl = weburl + taskUrl + listId + "&ID=" + taskId;

    8     string htmlTaskLink = "<a href=" + "\"" + fulltaskUrl + "\"" + ">Click here to open the task directly in SharePoint</A>";

    9 

   10     return htmlTaskLink;

   11 }

 

Steps

The above function will return the HTML code for task link given the "taskId" parameter.

The main idea here is to get the "taskId" parameter, which is actually the "ListItemId" of the task. In order to get its value, we can bind this task properties with a variable.

  1. In your code, create a public Int32 variable
  2. Navigate to "Workflow Designer" view
  3. Right Click on the "Create Task" activity of the task you want to link, select "Properties"
  4. In properties, select "ListItemId", then clicks the ellipsis (...) button that appears
  5. Select the variable created in "Step 1" and click "OK" to bind it.
  6. Finish!

2008年5月15日星期四

Custom 'Save' Button in InfoPath Form to save into MOSS Document Library

Overview

I always try to hide the Top and Bottom Toolbar (the one showing "Save", "SaveAs", "Close") in my Browser-enabled InfoPath Forms. But how can I let the user to save the Form into a Document Library without showing the toolbar?. The answer is to submit the form to the destination MOSS Document Library.

Reference

Create a custom Save Button in InfoPath

Steps

  1. In InfoPath 2007, choose 'Tools' => 'Submit Options'
  2. Check 'Allow users to submit this form', choose 'Send form data to a single destination' radio button, select 'SharePoint document library' in the dropdown under the 'Send form...' radio button.
  3. Under the 'SharePoint document library' dropdown, click 'Add' button.
  4. In 'Data Connection Wizard', enter the full URL of the Document Library (e.g. "http://localhost/Doc Lib/Forms/AllItems.aspx" ) in the 'Document Library' Text box.
  5. Enter File name for the saved Form, you can add function to dynamically create file name. (By clicking the 'fx' button on the right). Click 'Next'
  6. Enter the name for this data connection.
  7. After you create the data connection, you should convert it into .udcx file and saved in inside the MOSS server for administrator approval. Check My Previous Post for detail steps.

2008年5月11日星期日

How to embed browser-enabled InfoPath Forms into Webpart

Overview

To have a browser-enabled InfoPath Form is nice, but to have an InfoPath Form embed webpart that can be put at anywhere in your page is even more nicer!!! The following PDF file by Nick Grattan Consultancy Limited will shows you how to used out-of-the-box "XmlFormView" Library as a webpart container of browser-enabled InfoPath Forms.

Reference

How to Host Microsoft InfoPath Forms in SharePoint 2007 Web Part Pages (PDF)

Copying Files between Document Libraries in WSS 3.0 Workflow

Overview

Sometimes you would need to move/copy files to different Document Libraries during a workflow process, but when using 'File.CopyTo' or 'File.MoveTo' method there may be build errors. If this is the case, then you can use the following snippet (Copied from 'cwogle' ) to manually 'copy' a file to the destination Document Library.

On the other hand, if you want to copy the whole SPListItem to another Document Library, then you can use 'SPListItem.CopyTo()' method.

Reference

moving sharepoint files to different folder

Code Snippet

    1 // Get Destination Folder

    2 SPWeb currWeb = workflowProperties.Web;

    3 SPFolder destnFolder = currWeb.GetFolder("http://host/DocLibrary/");

    4 

    5 // Copy the File to there

    6 SPListItem item = workflowProperties.Item;

    7 Byte[] fileContents = item.File.OpenBinary();

    8 SPFile newFile = destnFolder.Files.Add(

    9     destnFolder.ServerRelativeUrl + "/" + item.File.Name,

   10     fileContents,

   11     item.File.Author,

   12     item.File.ModifiedBy,

   13     item.File.TimeCreated,

   14     item.File.TimeLastModified);

Update Workflow Task properties with 'UpdateTask Activity'

吹水

OK~ 之前幾個post打左咁多英文, 都係時候講下廣東話啦... :p
話說我今個星期接到單非常好玩既job, 就係無人做過既 WSS/MOSS Workflow 啦~ 個期仲要鬼咁急, 不過只係做demo啫~
由於我係用 Sequential Workflow + Looping  + Create / Update / Delete Tasks, 所以出現好多問題, 最後我用左個折衷方法就係只用一個task, 靠update佢既 "Title" 同 "AssignedTo" properties 黎 "扮" 不同既 tasks. 不過最後我發覺原來要 update 一個 task 既 properties 係幾煩既....

Reference

Task reassignments using UpdateTask Activity

Overview / Steps (用返英文啦)

In order to update the task properties, 'UpdateTask' Activity should be used in VS2005 Workflow Designer. If you cannot find this in the Toolbox, try making a new Tab in Toolbox and then right-click and select "Choose Items...", then add "Microsoft.SharePoint.WorkflowActions.dll".

After 'UpdateTask' Activity is inserted, double click on it in Workflow Designer and use "UpdateTask" class to set new value for the task properties.

Code Snippet:

  113 private void updateTask1_MethodInvoking(object sender, EventArgs e)

  114         {

  115             UpdateTask task = (UpdateTask)sender;

  116             task.TaskProperties.AssignedTo = this.assignee;

  117             task.TaskProperties.Title = "Please update...";

  118         }

In the above snippet, the "AssignedTo" and "Title" properties are updated.

Key Point: Setting "AfterProperties" for "OnTaskChanged" Activity and "TaskProperties" for "UpdateTask" Activity

Very often you will find that using the method state above could not update the task properties, this is because the "OnTaskChanged.AfterProperties" and "UpdateTask.TaskProperties" are both bound to the same "SPWorkflowTaskProperties" object. So make sure that they are NOT bound to the same Properties.

I also found that if you have more that one "OnTaskChanged" Activities and "UpdateTask" Activities for a certain task, you only need two "SPWorkflowTaskProperties" objects. One for all "OnTaskChanged" Activities and the other for all "UpdateTask" Activities.

2008年5月9日星期五

Accessing Data from Workflow Association and Initiation Forms in Windows SharePoint Services 3.0

Reference 

Accessing Data from Workflow Association and Initiation Forms in Windows SharePoint Services 3.0

Overview

It is often that a Workflow template would need some initial parameters when it is first associated to a document library or started by an event. In SharePoint Products, it is supported by adding Association and Initiation Forms to the Workflow template.

However, WSS 3.0 does not support InfoPath Form Services (I remember only MOSS 2007 Enterprise Edition supports this). We are going to create the Assoc/Init Forms by ASP.NET Forms, and apply the form value into the Workflow instance.