If your form contains logic that checks to see if it is read-only (thisXDocument.IsReadOnly), there is an issue with Outlook where InfoPath will report false positives depending on your Outlook cache settings.
Most of the time, it doesn't make sense to call IsReadOnly for an attachment, so the workaround would be to determine if your code is an attachment or not and only use IsReadOnly when it is opened from a shared website or local folder.
Here's some C# code to determine if your form is an attachment or not:
private string getFormPath() { string sFormUri = thisXDocument.URI; int iPosition = sFormUri.LastIndexOf("/");
// if path is outlook file cache, this will return "" if (-1 != iPosition) // Just return path return sFormUri.Substring(0, iPosition + 1); else return ""; }
private string getSharePointFolder() { string sUri = thisXDocument.Solution.URI; int iPosition = sUri.LastIndexOf("/Forms/"); return -1 != iPosition ? sUri.Substring(0, iPosition + 1) : ""; } _fOpenedLocally = (0 != string.Compare(getFormPath(), getSharePointFolder())); |