Guardar Infopath en lista Sharepoint

  • Thread starter gonzalez_karlos
  • Start date
G

gonzalez_karlos

Estoy intentando crear una página web aspx donde una persona sin
permisos para ver un documento Infopath, pueda a través de
impersonación editar dicho documento y guardarlo.
Todo funciona bien, uso un control XmlFormView con la propiedad
XmlLocation="/Form library/infopathForm.xml"

Pero el botón save implementado dentro del control XmlFormView
devuelve error de permisos puesto que invoca directamente un
webService del servidor sharepoint y no se ha realizado impersonación
con permisos adecuados.

Otra aproximación es crear un botón que guarde el formulario
modificado. Al tratarse el Button.click en servidor, se ha impersonado
a una cuenta con privilegios. Accedo al formulario
XmlFormView1.DataBind();
XmlForm xmlForm= XmlFormView1.XmlForm();
xmlForm.save(); // Devuelve error "The method or operation is not
implemented"
Esto devuelve el error del comentario.

Otra aproximación es obtener la representación xml del formulario y
guardarlo como el contenido xml del fichero que aloja el fichero
infopath original
SPWeb activeSite= new SPSite( fileUrl).OpenWeb();
SPFile spFile= activeSite.GetFile( fileUrl);
spFile.SaveBinary( binXml, false);

, pero tampoco funciona puesto que devuelve
The security validation for this page is invalid. ...

¿Alguien podría sugerirme alguna aproximación que funcione?
 
G

gonzalez_karlos

English version

I am trying to create an aspx page where a person without privileges
will be able through impersonation to edit and save an infopath
document.
Everything is working fine using an XmlFormView control setting its
XmlLocation="/Form library/infopathForm.xml"

But the save button implemented inside the XmlFormView control returns
an error related with the permissions of the user given that the
button directly invokes a webService on the sharepoint server giving
no chance of making impersonation with the proper rights.

Other approach was to create a button to save on the server the
modified form. The impersonation takes place but...

- When acceding the form using this code:
XmlFormView1.DataBind();
XmlForm xmlForm= XmlFormView1.XmlForm();
xmlForm.save(); // Devuelve error "The method or operation is not
implemented"

The method save return the commented error!!!


- Other approach is to obtain the xml representation of the modified
form and save it as the content of the file that holds the infopath
form using this code:

SPWeb activeSite= new SPSite( fileUrl).OpenWeb();
SPFile spFile= activeSite.GetFile( fileUrl);
spFile.SaveBinary( binXml, false);


.. This does not work neither given that it throws this exception
"The security validation for this page is invalid". ...


Could someone suggest me other approach or the error I am making to
make this work?
 
L

leikas

English version

I am trying to create an aspx page where a person without privileges
will be able through impersonation to edit and save an infopath
document.
Everything is working fine using an XmlFormView control setting its
XmlLocation="/Form library/infopathForm.xml"

But the save button implemented inside the XmlFormView control returns
an error related with the permissions of the user given that the
button directly invokes a webService on the sharepoint server giving
no chance of making impersonation with the proper rights.

Other approach was to create a button to save on the server the
modified form. The impersonation takes place but...

- When acceding the form using this code:
XmlFormView1.DataBind();
XmlForm xmlForm= XmlFormView1.XmlForm();
xmlForm.save(); // Devuelve error "The method or operation is not
implemented"

The method save return the commented error!!!

- Other approach is to obtain the xml representation of the modified
form and save it as the content of the file that holds the infopath
form using this code:

SPWeb activeSite= new SPSite( fileUrl).OpenWeb();
SPFile spFile= activeSite.GetFile( fileUrl);
spFile.SaveBinary( binXml, false);

. This does not work neither given that it throws this exception
"The security validation for this page is invalid". ...

Could someone suggest me other approach or the error I am making to
make this work?

You've probably already gotten help for this, but for the sake of
search engines, at least the last approach should work when you set:

activeSite.AllowUnsafeUpdates = true;

E.g.

SPWeb activeSite= new SPSite( fileUrl).OpenWeb();

activeSite.AllowUnsafeUpdates = true ;

SPFile spFile= activeSite.GetFile( fileUrl);
spFile.SaveBinary( binXml, false);

HTH,
Jarno
 

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

Similar Threads

diferentes encabezados pie pagina, contar paginas por secciones 0
I can't Publish a Project!! AYUDA!!!! PORFAVOR!! 0
Access 2000 0
zoonziiLLaaaa ! 0
hola ayudaaaaaa 0
pleaseeeeeeee 0
send to email 1
tarea 0

Top