A
Andrej
hi,
i have a form which i use in several formlibraries.
i am able to get the site and the formlib inside the form to know from which
formlib it was opened, but if i try to save it back to the formlib i get an
error.
i know there is a way to save the form through secondary datasource. the
problem is, that in this datasource the url is hardcoded, and connot be
changed. i do not want to have 10 form which are the same and just the one
secondary datasource is different.
here is an example of a source-code which i use to save the form, and the
errormessage.
source:
SPSite site = new SPSite("http://myserver/");//_FormLocation.ToString());
SPWeb web = site.OpenWeb("/mySite/Project/");
SPList myJobTickets = web.Lists["Tickets"];
byte[] fileBytes =
Encoding.ASCII.GetBytes(this.MainDataSource.CreateNavigator().OuterXml);
SPFile myFile = myJobTickets.RootFolder.Files.Add("humpti1.xml", fileBytes);
myFile.Item.Properties["Name"] = "mein name";
myFile.Item.Update();
ERROR:
The security validation for this page is invalid. Click Back in your Web
browser, refresh the page, and try your operation again.
Microsoft.SharePoint.SPException: The security validation for this page is
invalid. Click Back in your Web browser, refresh the page, and try your
operation again. ---> System.Runtime.InteropServices.COMException
(0x8102006D): The security validation for this page is invalid. Click Back in
your Web browser, refresh the page, and try your operation again.
at Microsoft.SharePoint.Library.SPRequestInternalClass.PutFile(String
bstrUrl, String bstrWebRelativeUrl, Object varFile, PutFileOpt PutFileOpt,
String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32
iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object
varProperties, String bstrCheckinComment, UInt32& pdwVirusCheckStatus,
String& pVirusCheckMessage)
at Microsoft.SharePoint.Library.SPRequest.PutFile(String bstrUrl, String
bstrWebRelativeUrl, Object varFile, PutFileOpt PutFileOpt, String
bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32
iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object
varProperties, String bstrCheckinComment, UInt32& pdwVirusCheckStatus,
String& pVirusCheckMessage)
--- End of inner exception stack trace ---
at Microsoft.SharePoint.Library.SPRequest.PutFile(String bstrUrl, String
bstrWebRelativeUrl, Object varFile, PutFileOpt PutFileOpt, String
bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32
iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object
varProperties, String bstrCheckinComment, UInt32& pdwVirusCheckStatus,
String& pVirusCheckMessage)
at Microsoft.SharePoint.SPFileCollection.AddInternal(String urlOfFile,
Object file, PutFileOpt fileOpt, String createdBy, String modifiedBy, Int32
createdByID, Int32 modifiedByID, DateTime timeCreated, DateTime
timeLastModified, Object varProperties, String checkInComment,
SPVirusCheckStatus& virusCheckStatus, String& virusCheckMessage)
at Microsoft.SharePoint.SPFileCollection.Add(String urlOfFile, Byte[] file,
Boolean overwrite, String checkInComment, Boolean checkRequiredFields,
SPVirusCheckStatus& virusCheckStatus, String& virusCheckMessage)
at Microsoft.SharePoint.SPFileCollection.Add(String urlOfFile, Byte[] file,
Boolean overwrite, String checkInComment, Boolean checkRequiredFields)
at Microsoft.SharePoint.SPFileCollection.Add(String urlOfFile, Byte[] file)
at JobticketStart_net.FormCode.CTRL102_5_Clicked(Object sender,
ClickedEventArgs e)
at
Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonEventHost.<>c__DisplayClass6.<>c__DisplayClassa.<add_Clicked>b__3()
at
Microsoft.Office.InfoPath.Server.Util.DocumentReliability.InvokeBusinessLogic(Thunk thunk)
at
Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonEventHost.<>c__DisplayClass6.<add_Clicked>b__2(Object sender, ClickedEventArgs e)
at
Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonEventHost.FireClickedEvent(Object sender, ClickedEventArgs args)
at
Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonFormCode.<>c__DisplayClass2.<>c__DisplayClass5.<Click>b__1()
at
Microsoft.Office.InfoPath.Server.DocumentLifetime.OMExceptionManager.CallFormCodeWithExceptionHandling(UserMessages userMessages, OMCall d)
An entry has been added to the Windows event log of the server.
Log ID:5337
i have a form which i use in several formlibraries.
i am able to get the site and the formlib inside the form to know from which
formlib it was opened, but if i try to save it back to the formlib i get an
error.
i know there is a way to save the form through secondary datasource. the
problem is, that in this datasource the url is hardcoded, and connot be
changed. i do not want to have 10 form which are the same and just the one
secondary datasource is different.
here is an example of a source-code which i use to save the form, and the
errormessage.
source:
SPSite site = new SPSite("http://myserver/");//_FormLocation.ToString());
SPWeb web = site.OpenWeb("/mySite/Project/");
SPList myJobTickets = web.Lists["Tickets"];
byte[] fileBytes =
Encoding.ASCII.GetBytes(this.MainDataSource.CreateNavigator().OuterXml);
SPFile myFile = myJobTickets.RootFolder.Files.Add("humpti1.xml", fileBytes);
myFile.Item.Properties["Name"] = "mein name";
myFile.Item.Update();
ERROR:
The security validation for this page is invalid. Click Back in your Web
browser, refresh the page, and try your operation again.
Microsoft.SharePoint.SPException: The security validation for this page is
invalid. Click Back in your Web browser, refresh the page, and try your
operation again. ---> System.Runtime.InteropServices.COMException
(0x8102006D): The security validation for this page is invalid. Click Back in
your Web browser, refresh the page, and try your operation again.
at Microsoft.SharePoint.Library.SPRequestInternalClass.PutFile(String
bstrUrl, String bstrWebRelativeUrl, Object varFile, PutFileOpt PutFileOpt,
String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32
iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object
varProperties, String bstrCheckinComment, UInt32& pdwVirusCheckStatus,
String& pVirusCheckMessage)
at Microsoft.SharePoint.Library.SPRequest.PutFile(String bstrUrl, String
bstrWebRelativeUrl, Object varFile, PutFileOpt PutFileOpt, String
bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32
iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object
varProperties, String bstrCheckinComment, UInt32& pdwVirusCheckStatus,
String& pVirusCheckMessage)
--- End of inner exception stack trace ---
at Microsoft.SharePoint.Library.SPRequest.PutFile(String bstrUrl, String
bstrWebRelativeUrl, Object varFile, PutFileOpt PutFileOpt, String
bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32
iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object
varProperties, String bstrCheckinComment, UInt32& pdwVirusCheckStatus,
String& pVirusCheckMessage)
at Microsoft.SharePoint.SPFileCollection.AddInternal(String urlOfFile,
Object file, PutFileOpt fileOpt, String createdBy, String modifiedBy, Int32
createdByID, Int32 modifiedByID, DateTime timeCreated, DateTime
timeLastModified, Object varProperties, String checkInComment,
SPVirusCheckStatus& virusCheckStatus, String& virusCheckMessage)
at Microsoft.SharePoint.SPFileCollection.Add(String urlOfFile, Byte[] file,
Boolean overwrite, String checkInComment, Boolean checkRequiredFields,
SPVirusCheckStatus& virusCheckStatus, String& virusCheckMessage)
at Microsoft.SharePoint.SPFileCollection.Add(String urlOfFile, Byte[] file,
Boolean overwrite, String checkInComment, Boolean checkRequiredFields)
at Microsoft.SharePoint.SPFileCollection.Add(String urlOfFile, Byte[] file)
at JobticketStart_net.FormCode.CTRL102_5_Clicked(Object sender,
ClickedEventArgs e)
at
Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonEventHost.<>c__DisplayClass6.<>c__DisplayClassa.<add_Clicked>b__3()
at
Microsoft.Office.InfoPath.Server.Util.DocumentReliability.InvokeBusinessLogic(Thunk thunk)
at
Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonEventHost.<>c__DisplayClass6.<add_Clicked>b__2(Object sender, ClickedEventArgs e)
at
Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonEventHost.FireClickedEvent(Object sender, ClickedEventArgs args)
at
Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonFormCode.<>c__DisplayClass2.<>c__DisplayClass5.<Click>b__1()
at
Microsoft.Office.InfoPath.Server.DocumentLifetime.OMExceptionManager.CallFormCodeWithExceptionHandling(UserMessages userMessages, OMCall d)
An entry has been added to the Windows event log of the server.
Log ID:5337