Advantco Azure Adapter used to connect Azure storage but that is not added in CPI.
So would need to connect externally using script from SAP CPI.
Script:
import java.io.*
import com.microsoft.azure.storage.*;
import com.microsoft.azure.storage.file.*;
import com.microsoft.azure.storage.common.*;
def Message processData(Message message) {
def body = message.getBody(java.lang.String) as String
String accountName = "myaccountstorage"
String accountKey = "Key"
String storageConnectionString = "DefaultEndpointsProtocol=https;" + "AccountName=" + accountName+ ";" + "AccountKey=" + accountKey;
CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString)
CloudFileClient fileClient = storageAccount.createCloudFileClient();
CloudFileShare share = fileClient.getShareReference("fsmshare");
String fileName = "filename1.jpg"
String fileContent = body
byte[] fileBytes = fileContent.getBytes()
CloudFileDirectory rootDir = share.getRootDirectoryReference();
CloudFileDirectory sampleDir = rootDir.getDirectoryReference("attachments_inbound");
CloudFile cloudFile = sampleDir.getFileReference(fileName); cloudFile.uploadFromByteArray(fileBytes, 0, fileBytes.length)
cloudFile.getProperties().setContentType("image/jpeg")
cloudFile.uploadProperties()
message.setBody("OK")
return message;
}
azure online training
ReplyDeleteazure training