<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>SharePoint Integration</title><link>https://www.infopathdev.com:443/forums/46.aspx</link><description> For questions concerning issues in the integration of SharePoint and Microsoft InfoPath.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Conditional Formatting on Edit</title><link>https://www.infopathdev.com:443/forums/thread/53165.aspx</link><pubDate>Sat, 27 Mar 2010 15:34:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:53165</guid><dc:creator>dasmay</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/53165.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=46&amp;PostID=53165</wfw:commentRss><description>I have an infopath form that was developed in Infopath 2003 and later upgraded to Infopath 2007. This form is saved to a Sharepoint 2007 library when submitted. This form uses the old JScript and calls out to windows shell to get logged user. I put the user id in a hidden text and compare it to values based in the Sharepoint list. If the userid is contained in the values returned from Sharepoint I use conditional formatting to hide an attachment control. This form runs full trust and is digitally signed.  The form works great when you fill out a new form and hides attachment control but if you open to read or edit an existing form its doesn&amp;#39;t work.  Does anyone have any ideas on what to look for ?

This is code on page load:

function XDocument::OnLoad(eventObj)
{
	//Load the form path: address to the library
	var wshShell = new ActiveXObject(&amp;quot;Wscript.Shell&amp;quot;);
	var wshEnv = wshShell.Environment(&amp;quot;Process&amp;quot;);
	var username = wshEnv.Item(&amp;quot;UserName&amp;quot;);
	var strEmployee = XDocument.DOM.selectSingleNode(&amp;quot;my:myFields/my:loginid&amp;quot;);
	strEmployee.text = username;

}

Here&amp;#39;s function that fire to determine user security :
contains(@ViewAttachments, loginid)

Then I say if username=false hide the attachment control.

Thanks in advance.</description></item></channel></rss>