Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / June 2007

Tip: Looking for answers? Try searching our database.

SharePoint - What site was Infopath form opened From Issue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike C - 26 Jun 2007 20:41 GMT
I have posted this before. Is this possible to do. Please advise.

I have a form template saved to a site collection in Sharepoint. I then have
this form available on a site template that users will use to create sub
sites with. When the user creates a site they then need to fill out this
form. The form is supposed to read data from a list on the site and
prepopulate some fields on the form with that data.

The issue I have is the form needs to know which sub site and document
library  it was opened from
in order to read from the list. I have been able to successfully do this
using this for new forms in a Loading event with code like below.

e.InputParameters["SaveLocation"].ToString();

The issue is this only work when the forms are opened in the browser. I need
to know how to accomplish this with forms opened in the Infopath client
application. Once the form
is saved I can use this to read the document library it was saved in :

e.InputParameters["XmlLocation"].ToString();

This is putting a project of mine on halt and is driving me nuts because if
you open the form and hit save it knows where to save it so you would think
you could access that information somehow.

If this is not possible please let me know.
Mike C - 27 Jun 2007 19:32 GMT
I figured this out finally. If anyone is interested.

You need to add this using line:

using System.Runtime.InteropServices;

Then add this inside your class:

[DllImport("Kernel32.dll", CharSet = CharSet.Auto)]
       public static extern IntPtr GetCommandLine();

Then you need to add something similar to this in your form loading event:

if (this.New)
               {
                   IntPtr cmdLineStr = GetCommandLine();
                   String commandLine = Marshal.PtrToStringAuto(cmdLineStr);
                   string[] splitCommand = commandLine.Split('"');
                   string splitUrl = splitCommand[1].ToString();
               }

This will give you the URL to the SharePoint Document Library that you
opened the from from.

> I have posted this before. Is this possible to do. Please advise.
>
[quoted text clipped - 23 lines]
>
> If this is not possible please let me know.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.