Error in IMAPISession.OpenEntry: MAPI_E_NOT_FOUND - outlook-redemption

I am using Redemption in some routines and one of those routines makes a call to:
RDOMail rdoMail = Globals.ThisAddIn.session.GetMessageFromID(mail.EntryID, folder.StoreID, Type.Missing);
And it throws this exception eventually, it does not always occurs:
Error in IMAPISession.OpenEntry: MAPI_E_NOT_FOUND StackTrace: at Interop.Redemption.IRDOSession.GetMessageFromID(String EntryIDMessage, Object EntryIDStore, Object Flags)
Why is it happening? anybody has any idea?
UPDATE
This is the context of the call:
Outlook.MailItem mail = folder.Items.Add(Outlook.OlItemType.olMailItem);
Outlook.Recipient r = Globals.ThisAddIn.Application.Session.CreateRecipient(getSingleAddress(mailDetails.from));
mail.To = mailDetails.to.Replace("<", "<").Replace(">", ">");
mail.Sender = r.AddressEntry;
mail.Subject = mailDetails.subject;
mail.Save();
RDOMail rdoMail = Globals.ThisAddIn.session.GetMessageFromID(mail.EntryID, folder.StoreID, Type.Missing);

This happens because MAPI cannot find the message with the specified entry id.
What is the context of this call? Where does mail variable come from? Do you call RDOSession.Logon or set the RDOSession.MAPIOBJECT property to Namespace.MAPIOBJEECT from Outlook?

Related

Getting error message as INVALID_ARGUMENT: Invalid recognition 'config': Invalid class id speech-to-text API

we are using Google's speech-to-text API. We are trying to implement an adaptation model with the API. However, while doing so, we are getting an error message as 'INVALID_ARGUMENT: Invalid recognition 'config': Invalid class id {id}'. When I see whether CustomClass is available from cloud API, it shows it is available. However, still get the same error while using it in speech adaptation configuration. I am following this document https://github.com/googleapis/java-speech/blob/d1307be7e5510f4e5d9cf075a8efc3bd924d7bcf/samples/snippets/src/main/java/com/example/speech/SpeechModelAdaptationBeta.java. Any help would be greatly appreciated.
I tried using https://github.com/googleapis/java-speech/blob/d1307be7e5510f4e5d9cf075a8efc3bd924d7bcf/samples/snippets/src/main/java/com/example/speech/SpeechModelAdaptationBeta.java. But got exception only.
Below is the code which I am trying with:
`SpeechSettings speechSettings = SpeechSettings.newBuilder().setCredentialsProvider(credentialsProvider).build();
AdaptationSettings adaptationSettings = AdaptationSettings.newBuilder().setCredentialsProvider(credentialsProvider).build();
// Instantiates a client
SpeechClient speechClient = SpeechClient.create(speechSettings);
AdaptationClient adaptationClient = AdaptationClient.create(adaptationSettings);
String customClassUUID = UUID.randomUUID().toString().replace("-", "");
List<PhraseSet.Phrase> phraseArray = new ArrayList();
phraseArray.addAll(Phrase.newBuilder()
.setValue(
String.format("Visit restaurants like %s%n", customClassUUID)));
phraseArray.add(Phrase.newBuilder().setValue("Burger").build());
List classItemArray = new ArrayList();
classItemArray.add(ClassItem.newBuilder().setValue("Lettuce").build());
classItemArray.add(ClassItem.newBuilder().setValue("Burger").build());
CustomClass customClass = adaptationClient.createCustomClass(CreateCustomClassRequest.newBuilder().setParent(parent).setCustomClassId(customClassUUID).setCustomClass(CustomClass.newBuilder().addAllItems(classItemArray).build()).build());
String customClassName = parent+"/customClasses/"+customClassUUID;
String phraseSetUUID = UUID.randomUUID().toString().replace("-", "");
PhraseSet phraseSet = adaptationClient.createPhraseSet(CreatePhraseSetRequest.newBuilder().setParent(parent).setPhraseSetId(phraseSetUUID).setPhraseSet(PhraseSet.newBuilder().setBoost(10f).addPhrases(
Phrase.newBuilder()
.setValue(
String.format("Visit restaurants like %s%n", customClassUUID))).build()).build());
RecognitionConfig config =
RecognitionConfig.newBuilder()
.setEncoding(AudioEncoding.LINEAR16)
.setSampleRateHertz(8000)
.setLanguageCode("en-US")
.setUseEnhanced(true)
.setModel("phone_call")
.setAdaptation(SpeechAdaptation.newBuilder()
.addPhraseSets(adaptationClient.createPhraseSet(CreatePhraseSetRequest.newBuilder().setParent(parent).setPhraseSetId(phraseSetUUID).setPhraseSet(PhraseSet.newBuilder().setBoost(10f).addAllPhrases(phraseArray).build()).build()))
.addCustomClasses(adaptationClient.createCustomClass(CreateCustomClassRequest.newBuilder().setParent(parent).setCustomClassId(customClassUUID).setCustomClass(CustomClass.newBuilder().addAllItems(classItemArray).build()).build())).build())
.build();`

PAHO : both `onMessageDelivered` and `onMessageArrived` is getting called

Here is my paho client connection
var client = new Paho.MQTT.Client(Constants.MQTT_HOST, Number(Constants.MQTT_PORT), Constants.MQTT_CLIENT_ID);
client.onConnectionLost = onConnectionLost;
client.onMessageArrived = onMessageArrived;
client.onMessageDelivered = onMessageDelivered;
client.connect({onSuccess:onConnect});
When i use
var message = new Paho.MQTT.Message(Utils.uintToString(enc));
message.destinationName = targetTopicName;
client.send(message);
to send message, both onMessageDelivered and onMessageArrived is getting called.
Are you subscribing to that same topic, or one using wildcards that would include it (e.g. #)?
If you were then, both onMessageDelivered and onMessage Arrived would be called. If you are not subscribing, then that sounds like a bug which you could raise here: https://github.com/eclipse/paho.mqtt.javascript/issues

Unable to send email via gmail api to multiple senders

We're using the new gmail api on iOS to send emails and everything works great for messages with single recipients. When we specify more than one in the "to" field, we get the following error:
Error Domain=com.google.GTLJSONRPCErrorDomain Code=400 "The operation couldn’t be completed. (Invalid to header)
I have verified the content we are sending is in fact a valid rfc822 message.
You should use a list in your to field.
E.g. :
[ "liz6beigle#hotmail.com",
"another.one#email.com" ]
Gmail has a limit of bounces and recipients you can send at the same time.
You cannot store multiple emails under a single string.
Placing a single email address on each line will give better readability and prevent parsing errors.
Here is a code sample in Java from google. I hope it will help others to understand :
/**
* Create a MimeMessage using the parameters provided.
*
* #param to Email address of the receiver.
* #param from Email address of the sender, the mailbox account.
* #param subject Subject of the email.
* #param bodyText Body text of the email.
* #return MimeMessage to be used to send email.
* #throws MessagingException
*/
public static MimeMessage createEmail(String to, String from, String subject,
String bodyText) throws MessagingException {
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
MimeMessage email = new MimeMessage(session);
InternetAddress tAddress = new InternetAddress(to);
InternetAddress fAddress = new InternetAddress(from);
email.setFrom(new InternetAddress(from));
email.addRecipient(javax.mail.Message.RecipientType.TO,
new InternetAddress(to));
email.setSubject(subject);
email.setText(bodyText);
return email;
}
Gmail API : Sending Messages
Check the first code sample.
This was a regression but we finished deploying the fix on Monday, 2014-08-25.
I think you can do the following
get the 'To' fields as this
"test1#example.com, test2#example.com"
then split it with ','
String mail1 = "test1#example.com";
String mail2 = "test2#example.com";
then do this
email.addRecipient(javax.mail.Message.RecipientType.TO,
new InternetAddress(mail1));
email.addRecipient(javax.mail.Message.RecipientType.TO,
new InternetAddress(mail2));
I checked this
it worked
You can use comma separated emails and loop through those emails
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
MimeMessage email = new MimeMessage(session);
Multipart multiPart = new MimeMultipart("alternative");
email.setFrom(new InternetAddress(from));
String to = "xyz#gmail.com,sjaksks#gmail.cm,hysrtt#gmail.com";
String[] split = to.split(",");
for(int i=0;i<split.length;i++) {
email.addRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress(split[i]));
}
email.setSubject(subject);
MimeBodyPart textPart = new MimeBodyPart();
textPart.setText(text, "utf-8");
MimeBodyPart htmlPart = new MimeBodyPart();
htmlPart.setContent(html, "text/html; charset=utf-8");
multiPart.addBodyPart(textPart);
multiPart.addBodyPart(htmlPart);
email.setContent(multiPart);
return email;
I had an exchange with the gmail team and they did confirm that this is actually a bug with their api. Not sure when it will be fixed as they didn't provide any more details but it's on their radar.

Sending Jagged Array as parameter to WCF Service using KSOAP2 in android

I am having an issue with sending a jagged Array to a wcf webservice. The method is expecting a studentId and jaggedArray of information related to the student. Here is the method signature in c#
String[][] SearchStudent(string studentId, String[][] additionalInformation);
According to KSOAP wiki page, the below piece of code should have worked. I've also tried it with Hashtable; it returned the same error message.
SoapObject additionalInformation = new SoapObject(NAMESPACE, "SearchStudent");
additionalInformation.addProperty("StudentFirstName", "John");
additionalInformation.addProperty("StudentLastName", "Doe
additionalInformation.addProperty("StudentDOB", "06101990");
SoapObject request = new SoapObject(NAMESPACE, "Authenticate");
request.addProperty("sessionId", params[0]);
request.addProperty("additionalInformation ", AuthParams);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.bodyOut = request;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(url);
androidHttpTransport.debug = true;
(new MarshalHashtable()).register(envelope);
androidHttpTransport.call(SOAP_ACTION + "SearchStudent", envelope);
SoapObject sResult = (SoapObject)envelope.getResponse();
I am getting the message Invalid argument error message.
What am I doing wrong here?
I was able to get it to work with envelope.version 10 and not 11. Here is the link to my other post where you can find the solution.

BillQuery for getting bills giving Unauthorized error in Intuit

I'm getting "Unauthorized" error while trying to use filter in Intuit:
Exception Details: Intuit.Ipp.Exception.InvalidTokenException: Unauthorized
The code below is used to setup the Service Context:
string AppToken = ConfigurationManager.AppSettings["applicationToken"].ToString(CultureInfo.InvariantCulture);
String realmId = HttpContext.Current.Session["realm"].ToString();
String accessToken = HttpContext.Current.Session["accessToken"].ToString();
String accessTokenSecret = HttpContext.Current.Session["accessTokenSecret"].ToString();
String consumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString(CultureInfo.InvariantCulture);
String consumerSecret = ConfigurationManager.AppSettings["consumerSecret"].ToString(CultureInfo.InvariantCulture);
IntuitServicesType intuitServiceType = (IntuitServicesType)HttpContext.Current.Session["intuitServiceType"];
OAuthRequestValidator oauthValidator = new OAuthRequestValidator(accessToken, accessTokenSecret, consumerKey, consumerSecret);
context1 = new ServiceContext(oauthValidator, AppToken, realmId, IntuitServicesType.QBO);
Query for retrieving the last modified bills is as below:
List<Bill> CustomerBills = billQry.ExecuteQuery<Bill>(context1).ToList<Bill>();
Please let me know, which parameter value I'm passing incorrectly.
The following code .NET DevKit code sends a malformed request body and results in a OAuth signature error. This is a bug in the DevKit.
BillQuery billQry = new BillQuery();
billQry.LastUpdatedTime = DateTime.Now.AddDays(-20);
billQry.SpecifyOperatorOption(FilterProperty.LastUpdatedTime, FilterOperatorType.AFTER);
billQry.LastUpdatedTime = DateTime.Now;
billQry.SpecifyOperatorOption(FilterProperty.LastUpdatedTime, FilterOperatorType.BEFORE);
billQry.PageNumber = 1;
billQry.ResultsPerPage = 15;
billQry.SpecifySortOption(SortProperty.LastUpdatedTime, SortOrderOption.HighToLow);
List<Intuit.Ipp.Data.Qbo.Bill>CustomerBills =billQry.ExecuteQuery<Intuit.Ipp.Data.Qbo.Bill>(context).ToList();
The workaround is to modify the sample code below to make the request and deserialize the response into Bill objects.
Sample Code on Pastebin

Resources