How can we extract Outlook documents using Redemption.dll (version: 5.6.0.3644 )? - outlook-redemption

I am using the Redemption.dll (version: 5.6.0.3644). I want to use the ‘IRDODocumentItem’ to extract documents from Outlook folders. How can I achieve that?

No, I am not extracting attachment from the mail. I have a simple Folder in outlook that contains some word and excel documents. I did some research and extracted them like this
if (objItem is RDODocumentItem)
{
RDOAttachments rdoAttachments = null;
RDOAttachment rdoAttachment = null;
try
{
rdoAttachments = ((RDODocumentItem)objItem).Attachments;
if (rdoAttachments.Count > 0)
{
RDOAttachment attachment = ((RDODocumentItem)objItem).Attachments[1];
attachment.SaveAsFile(path);
NAR(attachment);
rdoAttachment = rdoAttachments[1];
rdoAttachment.SaveAsFile(path);
}
}
finally
{
NAR(rdoAttachment);
NAR(rdoAttachments);
}
}
Is it the correct way to extract document ?

Related

How to read json file from ESP8266's SPIFFS with ArduinoJSON 6?

I am currently working on a project with ESP8266 (ESP-12E) and I need to store information in a json file (more convenient to access via the web interface and easier to manage than EEPROM for me).
My problem is the following: I'm using the latest version of ArduinoJSON (6), but I haven't seen many examples except on their site, and this code doesn't work for me :
void DeleteCycle(size_t idtodelete) {
File schedules = SPIFFS.open("/schedules.json", "r");
if(schedules && schedules.size()) {
DynamicJsonDocument schedulesjson(1300);
DeserializationError err = deserializeJson(schedulesjson, schedules);
Serial.println(err.c_str());
if (err) {
Serial.print(F("deserializeJson() failed with code "));
Serial.println(err.c_str());
}
else {
JsonArray array = schedulesjson.to<JsonArray>();
// array.remove(0);
serializeJson(array, Serial);
}
schedules.close();
}
else {
Serial.println("Failed to read file.");
}
}
I guess the problem is the JsonArray, it's empty !
But my JsonDocument is not, because if I do
JsonObject obj = schedulesjson[0];
String test = obj["name"];
Serial.println("Test : " + test);
I get the first key value (name) of my array at index 0
This is my first post on StackOverflow, I hope I did it right, thanks in advance for your help!
I answer myself because I found the solution to my problem: writing
schedulesjson.to<JsonArray>();
empties the json document, so you have to put it before
DeserializationError err = deserializeJson(schedulesjson, schedules);

When I try to read an X12 204 using EDI Fabric, I get "Invalid Node Name: ST", but the file is well formed. Any idea why?

Here's an example 204 I have made. It validates with a couple different validation tools (EDI Notepad and Altova), but when I try to use EDI fabric to parse it, it gets the ISA and GS data just fine, but then errors out with "Invalid Node Name: ST".
I can't figure out why, any ideas?
ISA*ZZ* *ZZ* *ZZ*XXXX *ZZ*YYYY *170130*1025*U*00401*485789958*0*P*~
GS*SM*YYYY*XXXX*20170130*1027*485790079*X*004010
ST*204*485790093
B2**YYYY**123456789**CC
B2A*00
L11*123456789*CR
S5*1*LD
G62*64*20160131*1*1351
SE*7*485790093
GE*1*485790079
IEA*1*485789958
Here is the code:
internal static void Parse204(FileStream file,
List<MyCompany.TruckRouteInfo> result)
{
var reader = EdiFabric.Framework.Readers.X12Reader.Create(file);
file.Flush();
var qEdiItems = reader.ReadToEnd();
var ediItems = qEdiItems.ToList();
var m204 = ediItems.OfType<M_204>().ToList();
foreach (var item in m204)
{
MyCompany.TruckRouteInfo stop = new MyCompany.TruckRouteInfo ();
foreach (var l11 in item.S_L11)
{
if (l11.D_128_2 == EdiFabric.Rules.X12004010204.X12_ID_128.CR)
{
stop.Reference1 = l11.D_127_1;
}
}
result.Add(stop);
}
}
I've just literally copied your example and pasted it to a file which was processed fine. Works on my machine :)
My best guess would be to open the file and inspect the line terminators for any discrepancies, which might have been sorted when I copied it\pasted it.

Vaadin File Uploading using FileFilter

I am Using Vaadin Framework. I need to Upload Files in the format of PDF,JAR & ZIP only. I tried with this code.This code is also I got from STACK OVER FLOW.
public void uploadStarted(StartedEvent event) {
// TODO Auto-generated method stub
System.out.println("***Upload: uploadStarted()");
ArrayList<String> allowedMimeTypes = new ArrayList<String>();
allowedMimeTypes.add("application/java-archive");
allowedMimeTypes.add("application/pdf");
allowedMimeTypes.add("application/zip");
String contentType = event.getMIMEType();
boolean allowed = false;
System.out.println(":::::::::::::contentType::::::"
+ contentType);
for (int i = 0; i < allowedMimeTypes.size(); i++) {
if (contentType.equalsIgnoreCase(allowedMimeTypes.get(i))) {
allowed = true;
break;
}
}
try {
if (allowed) {
System.out.println("boolean value:::::::allowed"
+ allowed);
finalDeedUpload.setReceiver(finalDeedFileUploadHandler);
finalDeedUpload.addListener(finalDeedFileUploadHandler);
} else {
showWarningNotification(
"Error:Please Upload File in Given Format", "");
}
This is working for while uploading PDf files it's working, while uploading Zip OR Jar file and any other file it is showing NULLPOINTER EXCEPTION.
Please help me.
Vaadin has a special upload component which is easy to use. There is a whole chapter in Book of Vaadin related to this component.
https://vaadin.com/book/-/page/components.upload.html
In Vaadin 14 there is a method setAcceptedFileTypes at class Upload:
MemoryBuffer buffer = new MemoryBuffer();
Upload upload = new Upload(buffer);
upload.setAcceptedFileTypes(new String[]{"application/zip", "application/pdf", "application/java-archive"});
The method setAcceptedFileTypes sets the HTML attribute accept at the <input type="file"> element and therefore limits / filters what the application user can upload.

API to upload bulk offline conversions?

I can able to upload single offline conversion to my adwords account through API.But I want to upload bulk conversions through API. Is there any way to upload bulk conversions in single API call. I am using v201402 adwords client library.
You could use the "MutateJobService" for this. This exactly serves your purpose
Here's the link:
https://developers.google.com/adwords/api/docs/reference/v201402/MutateJobService
https://developers.google.com/adwords/api/docs/guides/importing-conversions
Here is my c# code
public OfflineConversionFeedReturnValue UploadOfflineConversionsToExistingConversionType(List<OfflineConversionFeed> offlineConversions)
{
try
{
// Get the OfflineConversionFeedService.
OfflineConversionFeedService offlineConversionFeedService =
(OfflineConversionFeedService)User.GetService(
AdWordsService.v201509.OfflineConversionFeedService);
List<OfflineConversionFeedOperation> offlineConversionOperations = new List<OfflineConversionFeedOperation>();
foreach (OfflineConversionFeed conversion in offlineConversions)
{
OfflineConversionFeedOperation offlineConversionOperation =
new OfflineConversionFeedOperation();
offlineConversionOperation.#operator = Operator.ADD;
offlineConversionOperation.operand = conversion;
offlineConversionOperations.Add(offlineConversionOperation);
}
OfflineConversionFeedReturnValue offlineConversionRetval =
offlineConversionFeedService.mutate(offlineConversionOperations.ToArray());
return offlineConversionRetval;
}
catch (Exception e)
{
throw new System.ApplicationException("Failed upload offline conversions.", e);
}
}

No payload when receiving rich text or HTML mails with MULE

I'm trying to develop a Mule application with inbound IMAP connector. It works fine when the incoming mail is plain text but when it's HTML or Rich Text there's no text in the payload. How to make the application independent of the incoming mail type?
HTML or Rich Text are most probably MIME multipart emails. In that case, Mule tries to extract the text has payload only if the multipart email contains a first part that is has a content type starting with text/ (like text/plain). I reckon that in your case, the multipart email doesn't match this rule, thus Mule doesn't know what to do with it.
I suggest you use a choice router to deal with the case when there's no text in the payload after the email has been received. In that case, use whatever logic that is relevant to you to extract the content from one of the inbound attachments into which the different parts have been transferred.
I've been able to write some Java-code that bring out the text-part of a multipart message but I can't find a way to get this working with Mule. MUle wants to load the class with a String even though it's a multi part message.
The code I've written is below:
import javax.activation.DataHandler;
import javax.mail.*;
public class ReadMultipartMail3 {
public String stringback(Part payload) throws Exception {
String answer ="";
if(payload.isMimeType("text/plain") || payload.isMimeType("text/html"))
{
answer=(payload.getContent().toString());
}
else{
Multipart multipart = (Multipart) payload.getContent();
for (int x = 0; x < multipart.getCount(); x++) {
Part p = multipart.getBodyPart(x);
System.out.println("Content Type: "+p.getContentType());
BodyPart bodyPart = multipart.getBodyPart(x);
String disposition = bodyPart.getDisposition();
if (disposition != null && (disposition.equals(BodyPart.ATTACHMENT))) {
System.out.println("Mail have some attachment : ");
DataHandler handler = bodyPart.getDataHandler();
System.out.println("file name : " + handler.getName());
} else {
if(p.isMimeType("text/plain") || p.isMimeType("text/html"))
{
answer = (p.getContent().toString());
}
else if (p.isMimeType("multipart/alternative"))
{
Multipart mp = (Multipart)p.getContent();
int partsCount = mp.getCount();
for (int z = 0; z < partsCount; z++) {
System.out.println("Content Type: "+z+" "+mp.getBodyPart(z).getContentType());
if(mp.getBodyPart(z).getContentType().contains("text/plain"))
{answer = (String) mp.getBodyPart(z).getContent();}
}
}
}
}
}
return answer;}}

Resources