![]() |
|
|
|
#1
|
|||
|
|||
|
Hi, i am quite new to Infopath. I created a form and want to read the current loged in user from an ActiveDirectory and write it to an expression box. But whatever i do i get all the time the same Error Message.
System.Security.SecurityException Security error. at ARF.ARF.OnLoad(DocReturnEvent e) at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocu mentEventSink2_SinkHelper.OnLoad(DocReturnEvent pEvent) here is the piece of code i use for the access string user = System.Environment.UserName; Code:
IXMLDOMNode nodeUser = thisXDocument.DOM.selectSingleNode("my:myFields/my:user");
DirectoryEntry entry1 = new DirectoryEntry("LDAP://PCNAME");
Object obj1 = entry1.NativeObject
DirectorySearcher searchInitiatorName = new DirectorySearcher(entry1);
searchInitiatorName.Filter = "(sAMAccountName=" + user + ")"
SearchResult result1 = searchInitiatorName.FindOne();
string fullName = result1.Properties["name"][0].ToString();
searchInitiatorName.Dispose();
entry1.Dispose();
nodeUser.text = fullName;
Regards[/code] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Auto-File Naming/ Default Directory Saves | sgill32 | Word | 2 | 11-06-2008 02:12 PM |
| Active Directory | ababc | Misc | 0 | 09-19-2006 06:18 AM |
| Newbie - extensions only working in root directory | rlcarr71 | Misc | 0 | 04-24-2006 07:26 AM |