Skip to main content

Hi,


We use asp.net (c#) forms as the UI for our K2 Workflow solution.
Part of the process involves the users uploading files (via the web forms) to SharePoint Document libraries (see code snippets below). What we are finding is that the document libraries are getting way beyond the Microsoft recommend size and periodically we move older docs to a seperate archive doc library.


What I would like to do is once an item has been completed, then all related documents to be moved to the archive library automatically. I believe that there are 2 possible approaches - build it into the K2 process design or use the API in the asp.net webforms. I'd prefer to do this in asp.net.


We currently have code that CREATE the documents and UPDATE the documents (when they already exist). Is it possible to MOVE documents, and if so, how?



  • FileUpload cntrl = references the <asp:FileUpload> object
  • string FileID = the FileName property of the <asp:FileUpload> object


 public void CreateFile(FileUpload cntrl, string FileID)
{
    
ConnSMO();
     
SmartObject smObj = soServer.GetSmartObject("FY12_DealPack");
    
SmartFileProperty smFileProp = (SmartFileProperty)smObj.PropertiesO"File_K2_ServiceDefined"];
    
Stream StrUpload;
     StrUpload = cntrl.PostedFile.InputStream;
    
int strUplen;
     strUplen = cntrl.PostedFile.ContentLength;
    
byte:] byArr = new byte:strUplen];
     StrUpload.Read(byArr, 0, strUplen);
     smFileProp.Content = System.
    
Convert.ToBase64String(byArr, 0, byArr.Length);
     smFileProp.FileName = FileID;
    
smObj.Propertiese"Country"].Value = mlblCountry.Text;
     smObj.Properties>
"SoldToPartyName"].Value = mlblSiteName.Text;
     smObj.Propertiesp
"DealPackID"].Value = DealPackID.ToString();
     smObj.MethodToExecute =
"Create";
     soServer.ExecuteScalar(smObj);
}

 



 



public
void UpdateFile(FileUpload cntrl, String FileID)
{
     ConnSMO();
     
SmartObject smObj = soServer.GetSmartObject("FY12_DealPack");
     
SmartFileProperty smFileProp = (SmartFileProperty)smObj.Propertiesa"File_K2_ServiceDefined"];
     
Stream StrUpload;
     StrUpload = cntrl.PostedFile.InputStream;
     
int strUplen;
     strUplen = cntrl.PostedFile.ContentLength;
     
bytet] byArr = new bytenstrUplen];
     StrUpload.Read(byArr, 0, strUplen);
     smFileProp.Content = System.
Convert.ToBase64String(byArr, 0, byArr.Length);
     smFileProp.FileName = FileID;
     smObj.MethodToExecute =
"UpdateDocument";
     soServer.ExecuteScalar(smObj);  
}


 


 


 

Be the first to reply!

Reply