Hi All, i am trying to pass an sql query within get outlook mail message activities. The problem is that it is working fine when i am running it with the workflow.however when i try to pass it theough config file where i need to save it it is not reading all data. The query had to read email of last 7 days and access it…the filter used was : “@SQL=urn:schemas:httpmail:datereceived>='” +DateTime.Today.AddDays(-7).ToString(“dd/MM/yyyy”)+ “'AND (urn:schemas:httpmail:subject like ‘%XYZ%’) AND (urn:schemas:httpmail:subject like ‘%MNZ%’)” . However i cant pass this as it is in config file because it is giving error as cannot parse condition. Tried with a single quote in config ’ it is not reading any message of previous days…
Can you please replace " with “”“” (4 of them) and let me know
Hey @Abhi_G_G
Use below mentioned Query:
Directly into the filter:
String.Format("@SQL=urn:schemas:httpmail:datereceived>='{0}' AND (urn:schemas:httpmail:subject like '%XYZ%') AND (urn:schemas:httpmail:subject like '%MNZ%')",DateTime.Today.AddDays(-7).ToString("dd/MM/yyyy"))
OR
Store Below mentioned in the Config:
@SQL=urn:schemas:httpmail:datereceived>='{0}' AND (urn:schemas:httpmail:subject like '%XYZ%') AND (urn:schemas:httpmail:subject like '%MNZ%')
Note: Without any Quotes as it is!
And in Filter put below mentioned query:
String.Format(Config("YourKeyName").ToString,DateTime.Today.AddDays(-7).ToString("dd/MM/yyyy"))
Note: In above query Config is the Config Variable, Replace “YourKeyName” with the actual Key.
You will definitely get the output!
Regards,
Ajay Mishra
Is there a possibility of triming or removing first and last characters while it reads the config file
Yeah Abhi, just add .Trim in the assign activity in InitSettings
@Ajay Mishra, tried it but unfortunately it doesn’t seem to work. May i know in tjis instance what wss the keyword you were referring to.
@Abhi_G_G Tell me your finalise code which you are using? A screenshot or syntax will be appreciated!
Regards,
Ajay Mishra