Read Only lock on InfoPath form in Sharepoint.

D

DavidR

Hi,

I have a document library in Sharepoint that stores InfoPath forms of a
specific template.

I've used Visual Studio tools and C# to develop the InfoPath template. It
contains an HTML button in a custom task pane that calls through to the C#
code and, among other things, closes the form by using:-
thisApplication.XDocuments.Close(0);

When I test this on a form in the library it works correctly, but when I go
to reopen the form, I get an message :-
"This form cannot be filled out, either because you do not have adequate
permissions, another user has the form open, or the form is open in another
program. Do you want to open a read-only version of this form?"

The same message appears if I use the command:- thisApplication.Quit();

The message does not appear if I close the form manually (eg click cross
button).

I've seen a few other posts where people are getting this message, but not
in relation to the use of the code I have mentioned.

I was wondering if anyone knew why this happens in response to the commands
I have mentioned, and whether there is a fix or workaround.

Any help in this regard would be appreciated.

Thanks,
David.
 
C

Chris

Hi David,

I have the same problem, when opening the Infopath-Doc.
"This form cannot ..."
I open the document from a webserver (I send a xml-response with the
infopath-data)
Have you found a solution to avoid this message ?

Cheers,
Chris
 
D

DavidR

Hi Chris,

Yes I did find a solution to this one.

The custom task pane HTML Button was running a line of script like :-
window.external.Window.Extension.C#Method
to call a method in the Form Code for the InfoPath Doc.

The method, ran through its code and finally called
thisApplication.Quit(true), or one of the other close commands.

In the end I moved the line of code that quits infopath out of the C# Method
and into the script on the custom task pane. My script code ended up looking
like :-
window.external.Window.XDocument.Extension.C#Method;
window.external.Window.Close(true);

Running the Close method stops the error on reopen from occurring.

I'm not certain why this fixes it, but my guess is that the call to the
method on the InfoPath form puts a lock on it, and because the context is
never returned back to the script, the lock remains, and when you go to
reopen it, you get the message.

So, perhaps you have another process accessing code in your form, but the
code stops somehow (eg Quit, error, etc) before it can return to the context
of the caller.
Hope this helps a bit.

Cheers,
David.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top