Skip to main content

File Service Broker v2.0

 

 

 

 

This custom service broker allows the user to perform the following functions based on a full file path

 

 

  •  
  • Read from a file
  • Write a file to a folder location
  • Delete a file
  • Get a list of full path files names from a directory
  • Get a list of full path sub-directory names from a directory

     

 

 

This custom service broker is based on the original File Service Broker v1 written by Johnny Fang,

 

 

 

 

However, Please note that the two versions and function set are not compatible.

 

 

 

 

Does this work for Network Share?


Sorry for the late reply. Yes this should work with network share file paths, as long as the correct folder permissions are granted to the account assigned to run this service instance.


So far, this appears to work on 4.7 with the February cumulative update.  This may be obvious to everyone else, but I did have to go to the properties of the .dll file and unblock it in order to get it to work.


How can I get the File Size of a file using this service?


 Has anybody used the GetFiles method in a workflow in a for each loop? When I try to run a for each loop for each file using the GetFiles method in the folder, the File Name returned is a concatenation of all the file names in the folder. However when run through the SMO tester, that is not the case. Can somebody help understand this issue? 


Does this work for 4.6+?

 


Hello,

What is max file size that can be uploaded using this broker?


EDIT:
I had problem with adding files >20MB all I had to do was change web.config in k2 smartforms runtime and designer.

I made 2 changes:

1) change max file size that can be uploaded to file data file attachment i set it at 200MB by changing: <httpRuntime maxRequestLength="204800" ...

in this case max size must be given in kilobytes

2) change max allowed content size that can be stored:

<requestFiltering allowDoubleEscaping="true" /> 

With this: 

<requestFiltering allowDoubleEscaping="true">
    <requestLimits maxAllowedContentLength="209715200" />
</requestFiltering>

in this case max size must be given in bytes

 

https://community.k2.com/t5/K2-blackpearl-Articles/How-to-increase-default-file-size-limit-for-File-Attachment/ta-p/92828?nobounce=

 

Hope it will help someone someday

 

Greetings,

Wojtek


I got this to work in a for each loop to move 6 files  but it placed all the files in a folder with the date. Is there any way I can get this to not put in a folder as I need them directly in the root folder for another process to pick them up.


Hi,

How do I install this if the service isnt listed in the smartobject tester? I have unblocked the file in the service broker folder but it still doesnt appear in the list.

Thanks.


Peanutbutter22 

Have you copied "SourceCode.SmartObjects.Services.FileService.dll" to folder containing all service brokers? Its in install directoryServiceBroker (standard path: "C:Program Files (x86)K2 blackpearlServiceBroker".

Wojtek


Hi MickiC,

 

  The functionality you are referring to seems to be based on v1.0 version of the broker. That version automatically appends the date folder underneath it. Can you check again with this version?


Thanks Wojciech for your assistance with the fiel size check

 

  @Peanutbutter22 please check if you have done as what Wojciech mentioned.

 


Hi, yes I copied it across and unlocked it in the properties but it still doesn't appear. Thanks!


@peanutbutter22 - were you ever able to resolve your issue? We are having similar issues...



 


I assume it is not appearring when attempting to register the ServiceType?


 


Usually registering a broker will involve:


1.  Registering the ServiceType (the .dll assembly); this will surface the Service Broker and will be visible in the "ServiceObject Explorer" category afterwards


 


2.  The right clicking on the Service Broker to register the Service Instance:



 


3.  Then finally right clicking on the Service Instance to create/generate the SmartObject, or select the applicable Service Objects.


can it work in conjunction with the exchange mailbox service broker?

i would like to read an ameil, read the attachment and then save to file location


Hi,

 

I found an issue in the case that I would like to display the file attachment control in the list view.

I execute the read method with the filepath as parameter. But the file attachment control show as blank even though I transfer the "File data" output from the file service broker smartobject.

 

I tried to show only path and make sure that the path is correct.

 

Does anyone face this problem?


Hi Amornthep,

 

   If you are binding the list view to a list method like kGet Files], the full file path is returned via the hFile Name] property, and not the hFile Path] property. File Path was intended to be a input pararmeter for the method calls.

 

 


Thank you for your response.

 

Appreciated!!!


The community website is undergoing a revamp, and  I think the download links are taken down temporarily. Hopefully it should be back up soon.


 I am trying to execute the File System Service.Create method within my workflow and noticed that "Content" is a required input.  If you execute the method via the SmO Tester, only File Name and File Path are required.  

1. Is there a way to change this so that Content is not required?

2. If not, then what is the best way to obtain and input the file's Content?

 


1 more question in addition to the one above - in an earlier comment I saw it mentioned that this should work for network share file paths, however I can only seem to get it to work locally.  Is this something that has been addressed and has anyone been able successful in moving files to network share paths?  

Note, the account trying to execute this has the the proper access to the specific folder it's writing to, so it does not appear to be a permissions issue.  


I am using this broker in an a K2 Studio workflow runing 4.7 where I get files from an email in exchange and move them to a file share with a UNC. If it would help I can get some print screens of my configuration.


For the other question the input called filedata.content is the actual file through whatever method you are calling store the file in a value and put that value in as content. It would help to understand your workflow to be more specific. Where is the file originating from?


Thanks JamesKho for your work.

Works well with K2 5.1 on prem.

 

@mh 

I just installed it did a quick test and was able to copy (create method) a file from the smartobject tester to a network location.Works fine. so yes i can confirm it works for the network locations


Reply