writing a file to SharePoint on button click? - InfoPath Dev
in

InfoPath Dev

writing a file to SharePoint on button click?

Last post 03-23-2009 09:12 AM by CraigW. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-23-2009 08:04 AM

    writing a file to SharePoint on button click?

    Hi all,

    I have a forms-services rendered form and I would like to create file based on some of the contents when a button is clicked.

    I have managed to generate the file contents fine, but I CANNOT get it to write to anywhere!

    My first thought was to write the file back to another SharePoint document library, which I thought would be dead easy, but I can't get past SharePoint CAS, even when my InfoPath project dll is deployed to the GAC!!  Has anyone ever managed to get that working?  I've tried a custom policy but that didn't work either.

    As an alternative, I just tried using HttpContext.Current to send the file to the user, but that just returns a completely un-useful 'Critical Error' in forms services, with no other information.

    So, how does everyone else do this?

    Thanks,

    Craig

  • 03-23-2009 09:12 AM In reply to

    Re: writing a file to SharePoint on button click?

    Okay, I have now set Trust=Full in web.config, added my assembly to the SafeControls list in web.config AND added my assembly to the GAC and I STILL get a SharePoint CAS error!!!!!!

    Here is the error from forms services: 

    =====================

    Request failed.

    System.Security.SecurityException: Request failed.
    at Microsoft.SharePoint.SPSite.Dispose()
    at Purchase_Requisition.FormCode.PublishExport(String fileContent, String fileName, String exportListUrl)
    at Purchase_Requisition.FormCode.btnApproveRequisition_Clicked(Object sender, ClickedEventArgs e)
    at Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonEventHost.<>c__DisplayClass6.<>c__DisplayClass8.<add_Clicked>b__1()
    at Microsoft.Office.InfoPath.Server.Util.DocumentReliability.InvokeBusinessLogic(Thunk thunk)
    at Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonEventHost.<>c__DisplayClass6.<add_Clicked>b__0(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)
    at Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonFormCode.<>c__DisplayClass2.<Click>b__0()
    at Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonFormCode.Click(Document document, XPathNavigator container)
    at Microsoft.Office.InfoPath.Server.DocumentLifetime.EventClick.Play(Document document, BindingServices bindingServices, EventLogProcessor eventLogProcessor)
    at Microsoft.Office.InfoPath.Server.DocumentLifetime.Event.PlayEvent(Document document, BindingServices bindingServices, EventLogProcessor eventLogProcessor)
    at Microsoft.Office.InfoPath.Server.DocumentLifetime.EventLogProcessor.<>c__DisplayClass1.<ExecuteLog>b__0()
    at Microsoft.Office.InfoPath.Server.DocumentLifetime.EventLogProcessor.ExecuteLog(Int32 expectedEventLogID)
    at Microsoft.Office.InfoPath.Server.DocumentLifetime.Document.<>c__DisplayClass6.<PlayEventLog>b__3()
    at Microsoft.Office.Server.Diagnostics.FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock)
    The action that failed was:
    Demand
    The type of the first permission that failed was:
    Microsoft.SharePoint.Security.SharePointPermission
    The first permission that failed was:
    <IPermission class="Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
    version="1"
    ObjectModel="True"/>

    The demand was for:
    <PermissionSet class="System.Security.PermissionSet"
    version="1">
    <IPermission class="Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
    version="1"
    ObjectModel="True"/>
    </PermissionSet>

    The only permitted permissions were:
    <PermissionSet class="System.Security.PermissionSet"
    version="1">
    <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    version="1"
    Read="USERNAME"/>
    <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    version="1"
    Flags="Execution"/>
    <IPermission class="System.Security.Permissions.UrlIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    version="1"
    Url="file:///C:/Inetpub/wwwroot/wss/VirtualDirectories/80/"/>
    <IPermission class="System.Security.Permissions.ZoneIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    version="1"
    Zone="MyComputer"/>
    <IPermission class="System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    version="1"
    Level="Minimal"/>
    <IPermission class="System.Net.DnsPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    version="1"
    Unrestricted="true"/>
    <IPermission class="System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    version="1"
    Unrestricted="true"/>
    </PermissionSet>

    The method that caused the failure was:
    Void <add_Clicked>b__0(System.Object, Microsoft.Office.InfoPath.ClickedEventArgs)

    ========================

    Any ideas??

    Craig

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.