This commit is contained in:
@@ -784,25 +784,10 @@ namespace AyaNova.PlugIn.V8
|
|||||||
var af = AyaFile.GetItem(i.LT_O_AyaFile.Value);
|
var af = AyaFile.GetItem(i.LT_O_AyaFile.Value);
|
||||||
if (af == null) continue;
|
if (af == null) continue;
|
||||||
|
|
||||||
//Upload
|
|
||||||
|
|
||||||
|
|
||||||
MultipartFormDataContent formDataContent = new MultipartFormDataContent();
|
|
||||||
|
|
||||||
//Form data like the bizobject type and id
|
|
||||||
formDataContent.Add(new StringContent(util.RootObjectToAyaType(tid.RootObjectType).ToString()), name: "AttachToObjectType");
|
|
||||||
formDataContent.Add(new StringContent(Map[tid.ID].ToString()), name: "AttachToObjectId");
|
|
||||||
formDataContent.Add(new StringContent(ImportTag), name: "Notes");
|
|
||||||
//or if testing non-existant this is probably safe: long.MaxValue
|
|
||||||
|
|
||||||
|
|
||||||
StreamContent AttachmentFile = new StreamContent(af.GetContent());
|
|
||||||
AttachmentFile.Headers.ContentType = new MediaTypeHeaderValue(af.mimeType);
|
|
||||||
AttachmentFile.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data");
|
|
||||||
AttachmentFile.Headers.ContentDisposition.FileName = af.Name;
|
|
||||||
|
|
||||||
|
//Compile the FileData property
|
||||||
var sDate = i.LT_Common_Label_Created.ToString();
|
var sDate = i.LT_Common_Label_Created.ToString();
|
||||||
DateTime dtLastModified = DateTime.UtcNow;
|
DateTimeOffset dtLastModified = DateTime.UtcNow;
|
||||||
if (sDate != null)
|
if (sDate != null)
|
||||||
{
|
{
|
||||||
//parse out to UTC date
|
//parse out to UTC date
|
||||||
@@ -812,6 +797,33 @@ namespace AyaNova.PlugIn.V8
|
|||||||
dtLastModified = dt.ToUniversalTime();
|
dtLastModified = dt.ToUniversalTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dynamic dFileData = new JArray();
|
||||||
|
dynamic dFile = new JObject();
|
||||||
|
dFile.name = af.Name;
|
||||||
|
dFile.lastModified = dtLastModified.ToUnixTimeMilliseconds();
|
||||||
|
dFileData.Add(dFile);
|
||||||
|
|
||||||
|
//Upload
|
||||||
|
|
||||||
|
MultipartFormDataContent formDataContent = new MultipartFormDataContent();
|
||||||
|
|
||||||
|
//Form data like the bizobject type and id
|
||||||
|
formDataContent.Add(new StringContent(util.RootObjectToAyaType(tid.RootObjectType).ToString()), name: "AttachToObjectType");
|
||||||
|
formDataContent.Add(new StringContent(Map[tid.ID].ToString()), name: "AttachToObjectId");
|
||||||
|
formDataContent.Add(new StringContent(ImportTag), name: "Notes");
|
||||||
|
formDataContent.Add(new StringContent(dFileData.ToString()), name: "FileData");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//or if testing non-existant this is probably safe: long.MaxValue
|
||||||
|
|
||||||
|
|
||||||
|
StreamContent AttachmentFile = new StreamContent(af.GetContent());
|
||||||
|
AttachmentFile.Headers.ContentType = new MediaTypeHeaderValue(af.mimeType);
|
||||||
|
AttachmentFile.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data");
|
||||||
|
AttachmentFile.Headers.ContentDisposition.FileName = af.Name;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AttachmentFile.Headers.ContentDisposition.ModificationDate = dtLastModified;
|
AttachmentFile.Headers.ContentDisposition.ModificationDate = dtLastModified;
|
||||||
formDataContent.Add(AttachmentFile);
|
formDataContent.Add(AttachmentFile);
|
||||||
|
|||||||
Reference in New Issue
Block a user