public static void Run() { // ExStart:1 EmailApi emailApi = new EmailApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); String fileName = "email_test.eml"; String storage = ""; String folder = ""; try { // Upload source file to aspose cloud storage storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName)); // Invoke Aspose.Email Cloud SDK API to get message properties EmailDocument apiResponse = emailApi.GetDocument(fileName, storage, folder); if (apiResponse != null) { foreach (EmailProperty emailProperty in apiResponse.DocumentProperties.List) { Console.WriteLine("Property Name :: " + emailProperty.Name); Console.WriteLine("Property Value :: " + emailProperty.Value); } Console.WriteLine("Retrieve Message Properties, Done!"); Console.ReadKey(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } // ExEnd:1 }
public void TestGetDocument() { EmailApi target = new EmailApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "email_test.eml"; string storage = null; string folder = null; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\email\\resources\\" + name)); EmailDocument actual; actual = target.GetDocument(name, storage, folder); Assert.AreNotEqual(null, actual); Assert.IsInstanceOfType(new EmailDocument(), actual.GetType()); }