O
OMAF-Terry
Any help with this would be greatly appreciated.
Basically, my goal is to use InfoPath in a form submission and approval
manner but would require the integration of other programs and data.
User1 (the requester) would launch the InfoPath form via Macromedia
Dreamweaver (via Dreamweavers externsibility options) fill out a form and
email it to User2 (the approver). User2 would either approve or deny the
request sending the result back to User1. The forms would need to be
accessbile to every employee internally but no public access. All staff are
licensed for InfoPath.
Overall, my requirements look like this:
1. Forms for request and approval for internal staff
2. Forms to be sent and received via email (outlook)
3. User1 starts the InfoPath form from Macromedia Dreamweaver (by extending
Dreamweaver). The parameter Dreamweaver would need to pass InfoPath is the
file name they are checking in. (I don't need help with the Dreamweaver stuff)
4a.When User1 fills out a form for approval, their full name and email
adress need to automatically show up in the form so that the approver (User2)
know who it's from. These two fields would be read-only or hidden.
4b. When User1 fills out a form for approval they choose the recipient via a
drop-down list box. This list box contains all users in Active Directory.
When they select the recipient, the email recipient is set.
5. When User2 (the approver) receives the email they can via two buttons,
approve or reject the request. Clicking one of the buttons sends an email
reply notifying of the decission. The approver coulda also input comments
back to the requester.
6. If a request was rejected, User1 could re-submit the same form to User2
so that data is retained.
I've looked at a few tutorials and threads in this group but can't grasp the
big picture on how to do this.
I started with this tutorial:
http://msdn.microsoft.com/office/de...y/en-us/odc_ip2003_tr/html/odc_INF_Lab_15.asp
where I changed it a bit and now have a form load with two text boxes
populated automatically (current users full name and email address). I did
this using C#. My souce code is at the bottom of this message.
Given the above, my questions are:
1. Does what I'm trying to do with InfoPath sound feasible?
2. Where would the InfoPath forms sit to enable all staff to access them but
still email copies of the forms back and forth retaining data?
3. What will I need to do security wise with InfoPath. Note that because
this will be deployed behind our firewall, security is important but not
critcal
4a. I quickly found that getting Active Directory information is best done
via web services. I've been somewhat sucessfull with this but how do I get my
web service I created locally to run on our webserver? (Permissions, what
files need to be there, etc)
4b. Is the way I created this web service the way to go or does a better way
exists?
5. How do I call to the web service from InfoPath?
Thanks for any help.
CODE:
==========================
using System;
using Microsoft.Office.Interop.InfoPath.SemiTrust;
using System.DirectoryServices;
// Office integration attribute. Identifies the startup class for the form.
Do not
// modify.
[assembly: System.ComponentModel.DescriptionAttribute("InfoPathStartupClass,
Version=1.0, Class=loggedInUserInfo.loggedInUserInfo")]
namespace loggedInUserInfo
{
// The namespace prefixes defined in this attribute must remain
synchronized with
// those in the form definition file (.xsf).
[InfoPathNamespace("xmlns:my=\"http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-06-06T18-05-58\"
xmlns:xsf=\"http://schemas.microsoft.com/office/infopath/2003/solutionDefinition\"
xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xdUtil=\"http://schemas.microsoft.com/office/infopath/2003/xslt/Util\"
xmlns:xdXDocument=\"http://schemas.microsoft.com/office/infopath/2003/xslt/xDocument\"
xmlns:xdMath=\"http://schemas.microsoft.com/office/infopath/2003/xslt/Math\"
xmlns:xdDate=\"http://schemas.microsoft.com/office/infopath/2003/xslt/Date\"
xmlns:xd=\"http://schemas.microsoft.com/office/infopath/2003\"")]
public class loggedInUserInfo
{
private XDocument thisXDocument;
private Application thisApplication;
public void _Startup(Application app, XDocument doc)
{
thisXDocument = doc;
thisApplication = app;
}
public void _Shutdown()
{
}
// The following function handler is created by Microsoft Office InfoPath.
Do not
// modify the type or number of arguments.
[InfoPathEventHandler(EventType=InfoPathEventType.OnLoad)]
public void OnLoad(DocReturnEvent e)
{
//Setup variables
string strUserName = System.Environment.UserName;
IXMLDOMNode nodeCurrentEmail =
thisXDocument.DOM.selectSingleNode("my:myFields/my:currentUserEmail");
IXMLDOMNode nodeCurrentUserDisplayName =
thisXDocument.DOM.selectSingleNode("my:myFields/my:currentUserDisplayName");
IXMLDOMNode nodeAllAdUsers =
thisXDocument.DOM.selectSingleNode("my:myFields/my:lstAdUsers");
//Our System.Environment.UserName equals the "SAMAccountName" Active
Directory entry, search for it
DirectoryEntry entry = new
DirectoryEntry("LDAP://ou=people,ou=OMAF,dc=lrc,dc=ad,dc=gov,dc=on,dc=ca");
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + strUserName + ")";
search.PropertiesToLoad.Add("givenName");
search.PropertiesToLoad.Add("sn");
search.PropertiesToLoad.Add("mail");
SearchResult result = search.FindOne();
//Display full name and email for the logged in user
nodeCurrentEmail.text = result.Properties["mail"][0].ToString();
nodeCurrentUserDisplayName.text =
result.Properties["givenName"][0].ToString() + " " +
result.Properties["sn"][0].ToString();
//Second AD searcher
DirectoryEntry entry2 = new
DirectoryEntry("LDAP://ou=people,ou=OMAF,dc=lrc,dc=ad,dc=gov,dc=on,dc=ca");
System.DirectoryServices.DirectorySearcher mySearcher = new
System.DirectoryServices.DirectorySearcher(entry2);
mySearcher.Filter = ("(objectClass=*)");
mySearcher.PropertiesToLoad.Add("givenName");
mySearcher.PropertiesToLoad.Add("sn");
//List all AD users
string test = "";
foreach(System.DirectoryServices.SearchResult resEnt in
mySearcher.FindAll())
{
test = test + "\n" + resEnt.GetDirectoryEntry().Name.ToString();
}
thisXDocument.UI.Alert(test);
}
}
}
Basically, my goal is to use InfoPath in a form submission and approval
manner but would require the integration of other programs and data.
User1 (the requester) would launch the InfoPath form via Macromedia
Dreamweaver (via Dreamweavers externsibility options) fill out a form and
email it to User2 (the approver). User2 would either approve or deny the
request sending the result back to User1. The forms would need to be
accessbile to every employee internally but no public access. All staff are
licensed for InfoPath.
Overall, my requirements look like this:
1. Forms for request and approval for internal staff
2. Forms to be sent and received via email (outlook)
3. User1 starts the InfoPath form from Macromedia Dreamweaver (by extending
Dreamweaver). The parameter Dreamweaver would need to pass InfoPath is the
file name they are checking in. (I don't need help with the Dreamweaver stuff)
4a.When User1 fills out a form for approval, their full name and email
adress need to automatically show up in the form so that the approver (User2)
know who it's from. These two fields would be read-only or hidden.
4b. When User1 fills out a form for approval they choose the recipient via a
drop-down list box. This list box contains all users in Active Directory.
When they select the recipient, the email recipient is set.
5. When User2 (the approver) receives the email they can via two buttons,
approve or reject the request. Clicking one of the buttons sends an email
reply notifying of the decission. The approver coulda also input comments
back to the requester.
6. If a request was rejected, User1 could re-submit the same form to User2
so that data is retained.
I've looked at a few tutorials and threads in this group but can't grasp the
big picture on how to do this.
I started with this tutorial:
http://msdn.microsoft.com/office/de...y/en-us/odc_ip2003_tr/html/odc_INF_Lab_15.asp
where I changed it a bit and now have a form load with two text boxes
populated automatically (current users full name and email address). I did
this using C#. My souce code is at the bottom of this message.
Given the above, my questions are:
1. Does what I'm trying to do with InfoPath sound feasible?
2. Where would the InfoPath forms sit to enable all staff to access them but
still email copies of the forms back and forth retaining data?
3. What will I need to do security wise with InfoPath. Note that because
this will be deployed behind our firewall, security is important but not
critcal
4a. I quickly found that getting Active Directory information is best done
via web services. I've been somewhat sucessfull with this but how do I get my
web service I created locally to run on our webserver? (Permissions, what
files need to be there, etc)
4b. Is the way I created this web service the way to go or does a better way
exists?
5. How do I call to the web service from InfoPath?
Thanks for any help.
CODE:
==========================
using System;
using Microsoft.Office.Interop.InfoPath.SemiTrust;
using System.DirectoryServices;
// Office integration attribute. Identifies the startup class for the form.
Do not
// modify.
[assembly: System.ComponentModel.DescriptionAttribute("InfoPathStartupClass,
Version=1.0, Class=loggedInUserInfo.loggedInUserInfo")]
namespace loggedInUserInfo
{
// The namespace prefixes defined in this attribute must remain
synchronized with
// those in the form definition file (.xsf).
[InfoPathNamespace("xmlns:my=\"http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-06-06T18-05-58\"
xmlns:xsf=\"http://schemas.microsoft.com/office/infopath/2003/solutionDefinition\"
xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xdUtil=\"http://schemas.microsoft.com/office/infopath/2003/xslt/Util\"
xmlns:xdXDocument=\"http://schemas.microsoft.com/office/infopath/2003/xslt/xDocument\"
xmlns:xdMath=\"http://schemas.microsoft.com/office/infopath/2003/xslt/Math\"
xmlns:xdDate=\"http://schemas.microsoft.com/office/infopath/2003/xslt/Date\"
xmlns:xd=\"http://schemas.microsoft.com/office/infopath/2003\"")]
public class loggedInUserInfo
{
private XDocument thisXDocument;
private Application thisApplication;
public void _Startup(Application app, XDocument doc)
{
thisXDocument = doc;
thisApplication = app;
}
public void _Shutdown()
{
}
// The following function handler is created by Microsoft Office InfoPath.
Do not
// modify the type or number of arguments.
[InfoPathEventHandler(EventType=InfoPathEventType.OnLoad)]
public void OnLoad(DocReturnEvent e)
{
//Setup variables
string strUserName = System.Environment.UserName;
IXMLDOMNode nodeCurrentEmail =
thisXDocument.DOM.selectSingleNode("my:myFields/my:currentUserEmail");
IXMLDOMNode nodeCurrentUserDisplayName =
thisXDocument.DOM.selectSingleNode("my:myFields/my:currentUserDisplayName");
IXMLDOMNode nodeAllAdUsers =
thisXDocument.DOM.selectSingleNode("my:myFields/my:lstAdUsers");
//Our System.Environment.UserName equals the "SAMAccountName" Active
Directory entry, search for it
DirectoryEntry entry = new
DirectoryEntry("LDAP://ou=people,ou=OMAF,dc=lrc,dc=ad,dc=gov,dc=on,dc=ca");
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + strUserName + ")";
search.PropertiesToLoad.Add("givenName");
search.PropertiesToLoad.Add("sn");
search.PropertiesToLoad.Add("mail");
SearchResult result = search.FindOne();
//Display full name and email for the logged in user
nodeCurrentEmail.text = result.Properties["mail"][0].ToString();
nodeCurrentUserDisplayName.text =
result.Properties["givenName"][0].ToString() + " " +
result.Properties["sn"][0].ToString();
//Second AD searcher
DirectoryEntry entry2 = new
DirectoryEntry("LDAP://ou=people,ou=OMAF,dc=lrc,dc=ad,dc=gov,dc=on,dc=ca");
System.DirectoryServices.DirectorySearcher mySearcher = new
System.DirectoryServices.DirectorySearcher(entry2);
mySearcher.Filter = ("(objectClass=*)");
mySearcher.PropertiesToLoad.Add("givenName");
mySearcher.PropertiesToLoad.Add("sn");
//List all AD users
string test = "";
foreach(System.DirectoryServices.SearchResult resEnt in
mySearcher.FindAll())
{
test = test + "\n" + resEnt.GetDirectoryEntry().Name.ToString();
}
thisXDocument.UI.Alert(test);
}
}
}