Simple (?) Web Service - InfoPath Dev
in

InfoPath Dev

Simple (?) Web Service

Last post 02-19-2006 04:16 PM by AndersR. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 02-13-2006 10:51 AM

    Simple (?) Web Service

    Greetings!

    I have a few forms that I am creating which contain sensitive information. The problem is that with SharePoint permissions as I understand them, anyone who can submit a form to a library, can also read forms in that library. The only work-around that I can find to keep the form library secure is to have a webservice to submit the form to the library for the user. That way the form gets submitted and the library stays secure. My problem is one, I'm not sure if this is even possible. And two, if it is possible, I have no idea where to start. Can someone point me in the right direction?

    Thanks,

    Tom
  • 02-13-2006 10:25 PM In reply to

    Hi Tom,
    You are right - this is an issue. The other way to handle it is to use an Event Handler to move the forms from the form library after they are submitted. Both a Web service and an Event Handler will require administrator permissions on the server. You will want to write a Web service that checks the user's credentials and grants permissions based on that. The Recruiting Accelerator that my team at Microsoft created 2+ years ago is a great resource because it has code for a Web service that does this on top of a SQL database. It also includes web parts for showing the data on the SharePoint site. Please search MSDN or Microsoft sites for that project and let us know if you find it.

    Patrick Halstead [InfoPath MVP]
    InfoPath Dev Seattle
    Patrick Halstead
    Project Manager at Qdabra
  • 02-14-2006 04:50 AM In reply to

    Thanks for the response Patrick. I will report back any solutions I find to my problem. Thanks again.
  • 02-14-2006 07:25 AM In reply to

    Well I believe that I can achieve what I need to achieve by using an event handler as suggested above. If anyone out there has an example event handler that I might be able to look at, I would greatly appreciate it.

    Thanks!

    Tom
  • 02-14-2006 01:54 PM In reply to

    OK! I have made considerable progress on this issue today. I took Patrick's advice and created an Event Handler. The Event Handler simply takes any submitted document/form to a library and moves it to another library. I really like this solution as it doesn't require any new form code. However, I am having an issue with the Event Handler that I created. The Event Handler that I created seems to only work if the Document/Form libraries are on the same WSS site. It will not move the file from one WSS site to another, and more importantly it will not move a file from a Portal site's document library to a WSS site's document library. I put in an exception handler in the code and it is returning a: "Value does not fall within the expected range." error. I have attached the code for the assembly below.


    Imports Microsoft.SharePoint

    Public Class FormMove : Implements IListEventSink
    Public Sub OnEvent(ByVal listEvent As Microsoft.SharePoint.SPListEvent) Implements Microsoft.SharePoint.IListEventSink.OnEvent
    On Error Resume Next
    Dim SharePointWeb As SPWeb = listEvent.Site.OpenWeb()
    Dim SharePointEventItem As SPFile = SharePointWeb.GetFile(listEvent.UrlAfter)
    Dim oItem As SPListItem = SharePointEventItem.Item
    Dim sFileName As String = oItem.File.Name.ToString()

    If listEvent.Type = SPListEventType.Insert Then
    Err.Clear()
    Dim MoveToPath As String = "http://sharepointsite/doclib/" + sFileName
    SharePointEventItem.MoveTo(MoveToPath)

    End If

    End Sub 'OnEvent
    End Class
  • 02-19-2006 04:16 PM In reply to

    Hi Tom

    i did the exact thing a month ago or so, using Web services and EventHandlers (except i did it on the CheckIn event since i only wanted to copy the document when it was approved).

    the problem is that you cannot access the API across servers (or even portals), so you need to either use existing web services (check the lists.asmx web service in your SPPT SDK) or create a custom sharepoint web service (this is what i did) that you implement on the target box. Theres a good article on this subject on MSDNhttp://msdn.microsoft.com/library/en-us/odc_SP2003_ta/html/ODC_WritingCustomWebServicesforSPPT.asp

    hth

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