jscript - If statement

M

MartyO

I need to control the check-in check-out process. When a user opens an
InfoPath form in a SharePoint Form library, if they have NOT checked it out -
I want to send a message that they have to Check it out first and then I want
the InfoPath app to close down. Can anyone tell me what I'm missing here?
This code sends the message, but it doesn't quit InfoPath applicatioin and I
get a runtime error, "Permmission denied. File script.js Line 27" which is
the Application.Quit line of code.

function XDocument::OnLoad(eventObj)
{
if(XDocument.IsReadOnly)
XDocument.UI.Alert("This document is checked out by another user. It will
open in READ ONLY mode.");

else XDocument.UI.Alert("YOU MUST CHECK OUT THIS DOCUMENT BEFORE EDITING");
Application.Quit(false);
}

Thanks for help... tomorrow is my deadline for an answer on this issue! If
you can help you'll be a HERO!!
Marty
 
P

Patrick

You can do this to close Infopath :
XDocument.View.Window.Close(true);

Henning Krause said:
Hello,

see the help for this message:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipsdk/html/xdmthQuit_1.asp

Your form needs to be fully trusted for this method to work.

Greetings,
Henning Krause [MVP - Exchange]
==========================
Visit my website: http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(http://www.infinitec.de/software/mistaya.aspx)


MartyO said:
I need to control the check-in check-out process. When a user opens an
InfoPath form in a SharePoint Form library, if they have NOT checked it
out -
I want to send a message that they have to Check it out first and then I
want
the InfoPath app to close down. Can anyone tell me what I'm missing here?
This code sends the message, but it doesn't quit InfoPath applicatioin and
I
get a runtime error, "Permmission denied. File script.js Line 27" which is
the Application.Quit line of code.

function XDocument::OnLoad(eventObj)
{
if(XDocument.IsReadOnly)
XDocument.UI.Alert("This document is checked out by another user. It will
open in READ ONLY mode.");

else XDocument.UI.Alert("YOU MUST CHECK OUT THIS DOCUMENT BEFORE
EDITING");
Application.Quit(false);
}

Thanks for help... tomorrow is my deadline for an answer on this issue!
If
you can help you'll be a HERO!!
Marty
 
M

MartyO

Hi. Thanks Patrick. I gave it a try, but the error message I get is "Object
required". Any ideas?
Thanks!!
Marty

Patrick said:
You can do this to close Infopath :
XDocument.View.Window.Close(true);

Henning Krause said:
Hello,

see the help for this message:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipsdk/html/xdmthQuit_1.asp

Your form needs to be fully trusted for this method to work.

Greetings,
Henning Krause [MVP - Exchange]
==========================
Visit my website: http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(http://www.infinitec.de/software/mistaya.aspx)


MartyO said:
I need to control the check-in check-out process. When a user opens an
InfoPath form in a SharePoint Form library, if they have NOT checked it
out -
I want to send a message that they have to Check it out first and then I
want
the InfoPath app to close down. Can anyone tell me what I'm missing here?
This code sends the message, but it doesn't quit InfoPath applicatioin and
I
get a runtime error, "Permmission denied. File script.js Line 27" which is
the Application.Quit line of code.

function XDocument::OnLoad(eventObj)
{
if(XDocument.IsReadOnly)
XDocument.UI.Alert("This document is checked out by another user. It will
open in READ ONLY mode.");

else XDocument.UI.Alert("YOU MUST CHECK OUT THIS DOCUMENT BEFORE
EDITING");
Application.Quit(false);
}

Thanks for help... tomorrow is my deadline for an answer on this issue!
If
you can help you'll be a HERO!!
Marty
 
H

Henning Krause [MVP - Exhange]

Hello,

the XDocument.View object is not available during the OnLoad event.

Greetings,
Henning Krause [MVP - Exchange]
==========================
Visit my website: http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(http://www.infinitec.de/software/mistaya.aspx)


MartyO said:
Hi. Thanks Patrick. I gave it a try, but the error message I get is
"Object
required". Any ideas?
Thanks!!
Marty

Patrick said:
You can do this to close Infopath :
XDocument.View.Window.Close(true);

Henning Krause said:
Hello,

see the help for this message:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipsdk/html/xdmthQuit_1.asp

Your form needs to be fully trusted for this method to work.

Greetings,
Henning Krause [MVP - Exchange]
==========================
Visit my website: http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(http://www.infinitec.de/software/mistaya.aspx)


I need to control the check-in check-out process. When a user opens
an
InfoPath form in a SharePoint Form library, if they have NOT checked
it
out -
I want to send a message that they have to Check it out first and
then I
want
the InfoPath app to close down. Can anyone tell me what I'm missing
here?
This code sends the message, but it doesn't quit InfoPath
applicatioin and
I
get a runtime error, "Permmission denied. File script.js Line 27"
which is
the Application.Quit line of code.

function XDocument::OnLoad(eventObj)
{
if(XDocument.IsReadOnly)
XDocument.UI.Alert("This document is checked out by another user. It
will
open in READ ONLY mode.");

else XDocument.UI.Alert("YOU MUST CHECK OUT THIS DOCUMENT BEFORE
EDITING");
Application.Quit(false);
}

Thanks for help... tomorrow is my deadline for an answer on this
issue!
If
you can help you'll be a HERO!!
Marty
 
M

MartyO

Thanks!!.... I'm researching and trying to find out more about what "full
trust forms" are so that the Application.Quit will work.

In the meantime...do you know if, instead of testing for Read Only on the
form, if I can test for something like isCheckedOut?

Thanks sooo much!!
Marty

Henning Krause said:
Hello,

the XDocument.View object is not available during the OnLoad event.

Greetings,
Henning Krause [MVP - Exchange]
==========================
Visit my website: http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(http://www.infinitec.de/software/mistaya.aspx)


MartyO said:
Hi. Thanks Patrick. I gave it a try, but the error message I get is
"Object
required". Any ideas?
Thanks!!
Marty

Patrick said:
You can do this to close Infopath :
XDocument.View.Window.Close(true);

:

Hello,

see the help for this message:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipsdk/html/xdmthQuit_1.asp

Your form needs to be fully trusted for this method to work.

Greetings,
Henning Krause [MVP - Exchange]
==========================
Visit my website: http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(http://www.infinitec.de/software/mistaya.aspx)


I need to control the check-in check-out process. When a user opens
an
InfoPath form in a SharePoint Form library, if they have NOT checked
it
out -
I want to send a message that they have to Check it out first and
then I
want
the InfoPath app to close down. Can anyone tell me what I'm missing
here?
This code sends the message, but it doesn't quit InfoPath
applicatioin and
I
get a runtime error, "Permmission denied. File script.js Line 27"
which is
the Application.Quit line of code.

function XDocument::OnLoad(eventObj)
{
if(XDocument.IsReadOnly)
XDocument.UI.Alert("This document is checked out by another user. It
will
open in READ ONLY mode.");

else XDocument.UI.Alert("YOU MUST CHECK OUT THIS DOCUMENT BEFORE
EDITING");
Application.Quit(false);
}

Thanks for help... tomorrow is my deadline for an answer on this
issue!
If
you can help you'll be a HERO!!
Marty
 

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