Search


Showing posts with label infopath. Show all posts
Showing posts with label infopath. Show all posts

Monday, January 12, 2009

deployment administrator-approved infopath form templates

General deployment procedure uploading, upgrading, and removing administrator-approved form templates : http://technet.microsoft.com/en-us/library/cc262921.aspx

Monday, December 22, 2008

Query String passing in Infopath C# code

   1: public void FormEvents_Loading(object sender, LoadingEventArgs e) 
   2: { 
   3:     string lotNumber = string.Empty; 
   4:     try 
   5:     { 
   6:         e.InputParameters.TryGetValue("LotNumber", out lotNumber); 
   7:     } 
   8:     catch (Exception ex) 
   9:     { 
  10:         lotNumber = ex.Message.ToString();
  11:     } 
  12:     finally 
  13:     { 
  14:         MainDataSource.CreateNavigator().SelectSingleNode("//my:LotNumber", NamespaceManager).SetValue(lotNumber); 
  15:     } 
  16: }

Tuesday, December 16, 2008

Node manipulation using Xpath C# infopath code

   1: private string GetNodeValueFromMain(string xpath) 
   2: { 
   3:     string retValue = string.Empty; 
   4:     XPathNavigator retNode = MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager); 
   5:     if (retNode != null) 
   6:     { 
   7:         retValue = retNode.InnerXml; 
   8:     } 
   9:     return retValue; 
  10: } 

Occasionally, the node value that you are retrieving is relative to a particular event object site (for example, a sibling node in a Changed event). In the GetNodeValueFromEvent function, the event object is passed as an argument along with the XPath statement.

   1: private string GetNodeValueFromEvent(XmlEventArgs eventObject, string xpath) 
   2: { 
   3:     string retValue = string.Empty; XPathNavigator retNode = eventObject.Site.SelectSingleNode(xpath, NamespaceManager); 
   4:     if (retNode != null) 
   5:     { 
   6:         retValue = retNode.InnerXml; 
   7:     } 
   8:     return retValue; 
   9: } 

To retrieve a node value from a secondary data source, you must pass the name of the data connection as
an argument, along with the XPath statement, as shown with the GetNodeValueFromSecondary function.

   1: private string GetNodeValueFromSecondary(string source, string xpath) 
   2: { 
   3:     string retValue = string.Empty; XPathNavigator retNode = DataSources[source].CreateNavigator().SelectSingleNode(xpath, NamespaceManager); 
   4:     if (retNode != null) 
   5:     { 
   6:         retValue = retNode.InnerXml; 
   7:     } 
   8:     return retValue; 
   9: } 

Setting a Node Value Another task used in most managed-code solutions is setting a particular node value in the main data source. The SetNodeValueInMain function uses the first XPath statement argument to identify an XPathNavigator object and then set it to the value of the second argument.

   1: private void SetNodeValueInMain(string xpath, string nodeValue) 
   2: { 
   3:     XPathNavigator mainNode = MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager); 
   4:     if (mainNode != null) 
   5:     { 
   6:         mainNode.SetValue(nodeValue); 
   7:     } 
   8: } 

As with retrieving values, there are occasions where you might want to set a node value relative to a particular event object. Note that during certain events (for example, the Changing event), the main data source is read-only. In any
event, the SetNodeValueInEvent function uses an event object as an additional argument.

   1: private void SetNodeValueInEvent(XmlEventArgs eventObject, string xpath, string nodeValue) 
   2: { 
   3:     XPathNavigator eventNode = eventObject.Site.SelectSingleNode(xpath, NamespaceManager); 
   4:     if (eventNode != null) 
   5:     { 
   6:         eventNode.SetValue(nodeValue); 
   7:     } 
   8: } 

To set a secondary data source node value, you must pass the name of the data connection as an argument, along with the XPath statement and new node value, as shown with the SetNodeValueInSecondary function.

   1: private void SetNodeValueInSecondary(string source, string xpath, string nodeValue) 
   2: { 
   3:     XPathNavigator secondaryNode = DataSources[source].CreateNavigator().SelectSingleNode(xpath, NamespaceManager); 
   4:     if (secondaryNode != null) 
   5:     { 
   6:         secondaryNode.SetValue(nodeValue); 
   7:     } 
   8: }

Creating a Node Many times, a repeating section or repeating table control in a form
template has items added to it programmatically during the Loading event or based on specific actions at run time. The CreateNode function takes the first XPathNavigator object argument and appends the node identified by the other three arguments.

   1: private void CreateNode(XPathNavigator parentNode, string childNode, string childNodePrefix, string childNodeValue) 
   2: { 
   3:     if (parentNode != null) 
   4:     { 
   5:         parentNode.AppendChildElement(childNodePrefix, childNode, parentNode.LookupNamespace(parentNode.Prefix), childNodeValue); 
   6:     } 
   7: } 


Removing Nodes Whereas creating a node and adding it to a repeating section or repeating table is a common task, so too is removing a node from one of these repeating controls. The RemoveNode function takes the first XPathNavigator object argument and removes the child node identified with the second XPath
statement argument.

   1:  
   2: private void RemoveNode(XPathNavigator parentNode, string xpath) 
   3: { 
   4:     if (parentNode != null) 
   5:     {
   6:         XPathNavigator childNode = parentNode.CreateNavigator().SelectSingleNode(xpath, NamespaceManager); 
   7:         if (childNode != null) 
   8:         {
   9:             childNode.DeleteSelf(); 
  10:         } 
  11:     } 
  12: } 

 

Removing all items from a repeating section or repeating table involves a reverse iteration through
an XPathNodeIterator object. Here, the RemoveChildNodes function takes the XPathNavigator object and removes all of its child nodes.

   1: private void RemoveChildNodes(XPathNavigator parentNode) 
   2: { 
   3:     if (parentNode != null) 
   4:     { 
   5:         XPathNodeIterator childNodes = parentNode.CreateNavigator().Select("*", NamespaceManager); 
   6:         for (int i = childNodes.Count - 1; i >= 0; i--) 
   7:         { 
   8:             XPathNavigator childNode = parentNode.CreateNavigator().SelectSingleNode("*[last()]", NamespaceManager); 
   9:             childNode.DeleteSelf(); 
  10:         } 
  11:     } 
  12: }

How to Deploy an InfoPath 2007 Form Containing Managed Code to a Browser-Enabled WSS v3 Library

InfoPath Forms Services is NOT part of WSS v3. It is a separate install, or you can install it as part of the MOSS 2007 Beta 2 install. The RTM version, last I heard, will be available as a separate SKU or as part of MOSS 2007 Enterprise Edition. Assuming you have already created an InfoPath form containing managed code, this document will explain the steps necessary to deploy it to a WSS form library that is “web-enabled” by InfoPath Forms Services. Publish the Template to the File System (or file share) Note: In Office 2007 you can’t publish an InfoPath form containing managed code directly to a WSS form library because it has to be first approved by a WSS Administrator. 1. Open the Design Tasks task pane and choose Publish Form Template. 2. Choose the first option, to publish to SharePoint, and click Next. 3. Enter the location of the SharePoint site you want to publish to. 4. You will be presented with the screen below. Make sure the checkbox is checked to enable the form to be filled out in a browser and click Next. 5. You must choose a location to save the template file, which will be uploaded to the SharePoint site by the site administrator. 6. Specify any columns you want to be made available as WSS columns in the form library. 7. Verify that the information is correct and click Publish. The form will be published to the specified file share location. Upload the Template to the Central Administration Form Templates Library 1. Go to the Central Administration site for your farm (or web server if there's only one) 2. Click on the Application Management tab, go down to the InfoPath Forms Services section, and choose Manage Form Templates. 3. The Form Template library is opened, which is where admin-approved form templates for the farm are stored. 4. Click Upload Form Template. Choose your saved template file and click the Verify button. You will be shown any errors or warnings related to your template file. Read any warnings (hopefully there are no errors) and click OK. 5. Choose your template file again (Why is it not persisted in the text box between postbacks??). In the Upgrade section, you can choose to upgrade the form template if it already exists. You can also choose how to handle current sessions that are using the form template. 6. Click the Upload button to upload the form template. It is now available as a Feature to be activated on any site collections in the farm. Activate the Form Template on a Site Collection 1. You can activate a form template feature from the Manage Form Templates page of Central Administration (the same page where you uploaded the template). On the context menu of the newly uploaded form template, choose Activate to a Site Collection. 2. In the Activation Location section of the page, choose the appropriate Site Collection and click the OK button. Note: You may actually have to change Web Applications to find the site collection you are looking for. A Web Application maps to an IIS virtual server. Associate the Form Template with a Form Library 1. Create a new form library (or use an existing one, it really doesn't matter),go to the settings page. and choose Advanced Settings. 2. Choose Yes for Allow management of content types. For Opening browser-enabled documents, choose Display as a web page. 3. Click the OK button to go back to the Form Library Settings page. 4. There should now be a Content Types section which displays the Content Types enabled for the form library. The form template feature that you activated added a new content type to the Site Content Type Gallery. 5. Choose Add from existing site content types and find your form template. Click on it and click Add, then click OK. 6. Go back to your form library, click the New dropdown, and choose your form template. It will be opened in the browser window where it can be filled out and saved or submitted.

http://geekswithblogs.net/jgmeyer/archive/2006/06/26/83087.aspx

Friday, December 12, 2008

InfoPath Reference

InfoPath Improving the Performance of InfoPath 2007 Forms

http://msdn2.microsoft.com/en-us/library/bb380251.aspx

A whitepaper about performance and the InfoPath rich client. Because of differences between the client and browser-enabled forms, not everything applies to Forms Services and browser forms, but a must read nonetheless. InfoPath Forms Services best practices

http://technet.microsoft.com/en-us/library/cc261832(TechNet.10).aspx

Microsoft Office Forms Server TechNet TechCenter

http://technet.microsoft.com/en-us/office/bb267350.aspx

InfoPath Forms Services roadmap

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

InfoPath 2007 features that are unavailable in InfoPath Forms Services http://office.microsoft.com/en-us/infopath/HA102105871033.aspx Forms Server 2007 Home Page

http://office.microsoft.com/en-us/formsserver/FX100490391033.aspx

InfoPath 2007 Home Page

http://office.microsoft.com/en-us/infopath/FX100487661033.aspx Planning and architecture for Office Forms Server 2007

http://technet.microsoft.com/en-us/library/cc303371(TechNet.10).aspx

Plan InfoPath Forms Services

http://technet.microsoft.com/en-us/library/cc262498(TechNet.10).aspx

Office Developer Center: InfoPath 2007 Resource Center

http://msdn.microsoft.com/en-us/office/aa905443.aspx

InfoPath Forms Services Architecture

http://msdn2.microsoft.com/en-us/library/ms772323.aspx

Form Development and Deployment Lifecycle

http://msdn.microsoft.com/en-us/library/ms772031.aspx

Creating InfoPath Form Templates That Work With Forms Services

http://msdn2.microsoft.com/en-gb/library/aa945450(VS.80).aspx

Support: Microsoft Help and Support: Forms Server 2007 Solution Center

http://support.microsoft.com/ph/11846

Auto-Increment / Counting field for InfoPath repeating tables/sections

DOWNLOAD THE SAMPLE instruction: http://blogs.microsoft.co.il/blogs/yanivl/

december 12 2008

http://msdn.microsoft.com/en-us/library/ms439657.aspxsite definitions, templates, and features used in Windows SharePoint Services, describing how they are related and how they can best be used to customize sites. Features provide the following capabilities: Scoping semantics for determining where custom code runs Pluggable behavior for installing or uninstalling Features within a deployment Pluggable behavior for activating or deactivating Features at a given scope A scoped property bag for storing data required by a Feature within its scope The basis of a unified framework for distributed deployment of Windows SharePoint Services solutions Rules ===== i should be like event handler