As you can see now the URL is a bit longer, but still you can simplify it to this:
http://spserver/formsite/_layouts/FormServer.aspx?XmlLocation=formsite/infopathlibrary/myform.xml&DefaultItemOpen=1
This URL also open InfoPath directly in browser. Now lets have a look how code which would generate this URL would look like(code is used in workflow, but for something else would be similar):
string itemUrl = this.workflowProperties.Item.Web.Url;
itemUrl += "/_layouts/FormServer.aspx?XmlLocation=" + this.workflowProperties.Item.File.ServerRelativeUrl;
itemUrl += "&DefaultItemOpen=1";
itemUrl = itemUrl.Replace(" ", "%20");
I guess there is nothing to describe here, maybe just last line with replacing. This line replace all spaces with %20. Reason is simple, some browsers can not convert this unsafe character (I would recommend to create function to convert URL to safe URL) - for better understanding have a look here: http://www.blooberry.com/indexdot/html/topics/urlencoding.htm
No comments:
Post a Comment