How to use SmartObject to check for existence of a file in a SharePoint document library

  • 7 December 2009
  • 0 replies
  • 0 views

Badge +3

I have a SmartObject working in my integrated InfoPath form that saves documents to a SharePoint document library, and gets a list of all the documents in the library. For more information about that, see this document: http://www.k2underground.com/cfs-filesystemfile.ashx/__key/CommunityServer.Components.PostAttachments/00.00.03.41.44/How-to-upload-InfoPath-File-Attachments-with-SmartObjects-v1.0.pdf


I'm using the Create method on the library, so when someone tries to add a file that with the same name as a file in the library, the result is an InfoPath error that doesn't really explain what the problem is. I want to let the user know that he/she needs to rename the file. I suppose there is a way to get around this in code, but I want to see if I can do this without code.


Ideally, I would like a SmartObject method that would return a true value if the file has a duplicate name. Then I can skip the rule that saves the document to SharePoint and go to a rule that pops up a dialog message to the user that he/she should rename the file.


Does anyone know how to do something like this?


(I'm adding the file to a file attachment control in InfoPath, which doesn't seem to allow for getting the name of the file.)


Thanks,


Beth


0 replies

Be the first to reply!

Reply