I try to read an email Internet headers that we can view it in email properties in outlook app
I ask if there is an option so I can get this I use this code to read the emails in outlook
Outlook::Application outlook;
if (!outlook.isNull())
{
Outlook::NameSpace session(outlook.Session());
session.Logon();
Outlook::MAPIFolder *folder = session.GetDefaultFolder(Outlook::olFolderInbox);
Outlook::Items* mails = new Outlook::Items(folder->Items());
mails->Sort("ReceivedTime");
int num = mails->Count();
ui->label->setText(QString("I have %1 of messages").arg(QString::number(num)));
// Indexing starts from 1
for (int i = 1; i < num; i++)
{
Outlook::MailItem mail(mails->Item(i));
QString s = mail.Subject(); // do something with subject
QString b = mail.Body(); // do something with body
ui->plainTextEdit->appendPlainText("subject : \n" + s);
ui->plainTextEdit->appendPlainText("Body : " + b);
ui->plainTextEdit->appendPlainText("-----------------------------------------------");
}
}
and I was check the Outlook::MailItem for a function to get this Internet header but I not found so if any one try it before or have any idea to solve this
Thanks in advance
You can access the Internet headers via the PR_TRANSPORT_MESSAGE_HEADERS_W property. That property and other MAPI properties are retrievable via the PropertyAccessor object. Note though that individual x-headers are not accessible via a named MAPI property, they are bundled within the message headers so you'll need to parse every line of text to find any particular header record.
Related
Custom Search UI will be populated when user selects Complex asset in the Advance search screen drop down(apart from Folders,Contents) where 12 fields will be displayed .So when user clicks search button ,need to read those values and redirect to the alfresco repo files(org/alfresco/slingshot/search/search.get.js).We have already customized these files(search.get.js,search.lib.js) existed in the repository to suit out logic and working fine in 4.2.2;As we are migrating to 511,so we need to change this logic in customized faceted-search.get.js to read these values.How to write this logic in customized facted-search.get.js?
It's not actually possible to read those URL hash attributes in the faceted-search.get.js file because the JavaScript controller of the WebScript does not have access to that part of the URL (it only has information about the URL and the request parameters, not the hash parameters).
The hash parameters are actually handled on the client-side by the AlfSearchList widget.
Maybe you could explain what you're trying to achieve so that I can suggest an alternative - i.e. the end goal for the user, not the specifics of the coding you're trying to achieve.
We will be reading the querystring values something like below in the .get.js file.
function getNodeRef(){
var queryString = page.url.getQueryString();
var nodeRef = "NOT FOUND";
var stringArray = queryString.split("&");
for (var t = 0; t < stringArray.length; t++) {
if (stringArray[t].indexOf('nodeRef=') > -1) {
nodeRef = stringArray[t].split('=')[1];
break;
}
}
if (nodeRef !== "NOT FOUND") {
nodeRef = nodeRef.replace("://", "/");
return nodeRef;
}
else {
throw new Error("Node Reference is not found.");
}
}
It may be help you and we will wait for Dave Drapper suggestion also.
I'm making a windows service that triggers on the create message of a custom activity SMS. These program will send the actual sms using a third party sms service provider.
Therefore I need to get the mobilephone numbers for every contact/lead/user/account in the "To" field of the SMS activity. This is a field of type: Party List.
In addition I have another field ("new_msisdn") which I use it if "to" field be empty.(In this field user will type phone numbers directly)
I'm currently using the following code:
EntityCollection results = CrmService.RetrieveMultiple(query);
string msisdn;
string newmessage;
Entity entity;
int encode;
bool flash;
res = new Message[results.Entities.Count];
if (results != null && results.Entities.Count > 0)
{
try
{
for (int i = 0; i < results.Entities.Count; i++)
{
entity = results.Entities[i];
msisdn = (string)entity["new_msisdn"];
// I have to add an condition here to check if "to" is not empty , then get mobilephones.
newmessage = (string)entity["new_message"];
encode = ((OptionSetValue)entity["new_messagetype"]).Value;
flash = (bool)entity["new_flashsms"];
res[i] = new Message();
res[i].crmId = entity.Id;
res[i].senderNumber = msisdn;
res[i].sendDate = DateTime.Now;
res[i].message = newmessage;
if (encode == 1)
res[i].encoding = 1;
else
res[i].encoding = 2;
if (flash)
res[i].flash = 2;
else res[i].flash = 1;
}
}
I have no ideas to do this. By the way, I use CRM 2015.
Try to use something like below.
if(entity.Attributes.Contains("to"))
{
EntityCollection to=(EntityCollection)entitiy["to"];
foreach(Entity toEntity in to.Entities)
{
//You will get each to field record here.
//Use that information to get the mobile numbers of respective users.
Guid Id=toEntity.Id;
//Below code mostly will return string.empty.
//You may have to query CRM to get mobile number for respective contacts.
string mobileNumber=toEntity.Attributes.Contains("mobilenumber")?toEntity["mobilenumber"].ToString():string.Empty;
}
}
Hope I have addressed your query. Please let us know if you have any further questions on the same.
Also its a best practice to check whether attribute is already available in the entity object or not before using a particular attribute.
I am having issues with character encoding when viewing dynamic content from a broker database.
I have a scriptlet that calls the broker DB to generate a XML string and is then parsed by a XSL.
I have stripped back my code when debugging this issue and the script now looks like:
.....
strOutput= "<xml>";
ComponentPresentationFactory cpf = new ComponentPresentationFactory(PublicationID);
for (int i =0; i < itemURIs.length; i++)
{
ComponentPresentation cp = cpf.getComponentPresentation(itemURIs[i], strComponentTemplateURI);
if(cp != null){
String content = "";
content = cp.getContent();
strOutput += content;
}
}
strOutput+= "</xml>";
......
When i manualy overide this code and set the xml string content manualy in the code the data is displayed correctly on screen i.e. :
.....
strOutput= "<xml>";
ComponentPresentationFactory cpf = new ComponentPresentationFactory(PublicationID);
for (int i =0; i < itemURIs.length; i++)
{
ComponentPresentation cp = cpf.getComponentPresentation(itemURIs[i], strComponentTemplateURI);
if(cp != null){
String content = "<xml><dynamicContent><subtitle><![CDATA[Außenbeleuchtung]]></subtitle></dynamicContent></xml>";
strOutput += content;
}
}
strOutput+= "</xml>";
......
The conponent is published to the content broker DB using a CT with a output format set to "XML Format".
The publication target is set up as Target Language : JSP and Default Code Page : Unicode UTF-8
When i preview the content using this CT then the data is displayed correctly:
<dynamicContent>
<tcm_id>tcm:345-23288</tcm_id>
<title><![CDATA[LED Road R250 - Maximum LED performance for street and highway illumination]]></title>
<subtitle><![CDATA[Außenbeleuchtung ]]></summary>
</dynamicContent>
This is also the case when previewing through template builder.
The Broker DB is an Oracle DB (Oracle Database 11g Enterprise Edition Release 11.2.0.2.0) and i have checked the charecter set
SQL> select * from v$nls_parameters where parameter like '%CHARACTERSET%';
PARAMETER VALUE
NLS_CHARACTERSET UTF8
NLS_NCHAR_CHARACTERSET UTF8
Has anyone else come accross any examples like this before. It looks like there is an issue with either the DB storage , The connection to the DB or the cp.getContent(); method.
Any help would be greatly apreciated and if you have any further questions please let me know.
Regards,
Chris
Have a look at this article which discusses ways to solve encoding issues: http://elenaserghie.blogspot.ca/2012/01/7-clues-to-solve-character-encoding.html
Character encoding issues can be quite complex. In your case, since you have already done quite some investigation, I would start checking that the jsp file has the correct page encoding set:
<%# page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
I'm getting the following error when trying to use the Direct Show 9 backend with qt's phonon framework:
Pins cannot connect due to not supporting the same transport. (0x80040266)
Does anyone know what this error means and/or how to fix it? Is this a problem with the Direct Show 9 backend for phonon?
Apparently the problem has to do with bad metadata. If the Id3 tags aren't just right, the direct show 9 backend chokes on them. I solved the problem by writing the following function:
void removeTags(UDJ::DataStore::song_info_t& song){
static int fileCount =0;
if(song.source.fileName().endsWith(".mp3")){
UDJ::Logger::instance()->log("On windows and got mp3, copying and striping metadata tags");
QString tempCopy = QDesktopServices::storageLocation(QDesktopServices::TempLocation) + "/striped" + QString::number(fileCount) +".mp3";
if(QFile::exists(tempCopy)){
UDJ::Logger::instance()->log("Prevoius file existed, deleting now");
if(QFile::remove(tempCopy)){
UDJ::Logger::instance()->log("File removal worked");
}
}
bool fileCopyWorked = QFile::copy(song.source.fileName(), tempCopy);
if(!fileCopyWorked){
UDJ::Logger::instance()->log("File copy didn't work");
return;
}
TagLib::MPEG::File file(tempCopy.toStdString().c_str());
file.strip();
file.save();
Phonon::MediaSource newSource(tempCopy);
song.source = newSource;
if(fileCount == 3){
fileCount =0;
}
else{
fileCount++;
}
}
}
song_info_t is just a struct with a Phonon::MediaSource member in it called source. The function works by using taglib to strip off all of the metadata for a song and save the new song as a temporary file. The function also rotates the filename is uses for the temporary file so that it doesn't create an infinite number of temporary copy files. I hope this helps anyone else who is having this error.
I've been looking around the web for a simple and straight forward solution for the following problem but I cant seem to find anything that suits my needs.
I have an asp.net site with many subdirectories as follows.
http://mysite.com/dir1/subdir1/
http://mysite.com/dir1/subdir2/
http://mysite.com/dir2/
http://mysite.com/dir3/subdir1/
etc...
On each of my sites pages I need to extract the URL to the page minus the pagename and querystring.
So if the page name was http://mysite.com/dir1/subdir2/mypage.aspx?param=5¶m2=9
I would need the following http://mysite.com/dir1/subdir2/ I cant find any properties of the httprequest object that make this URL format readily available.
Take a look at this. It should give you everything you need, especially Url.Segments.
This works as well:
System.IO.Path.GetDirectoryName(url).Replace(#"\","/");
You're right, such thing is not ready so you need to make it yourself. One recipe is:
public string GetSubFolderURL()
{
string url = "http";
if (string.Equals(Request.ServerVariables["HTTPS"], "ON", StringComparison.CurrentCultureIgnoreCase))
url += "s";
url += "://";
url += Request.ServerVariables["SERVER_NAME"];
int port;
if (Int32.TryParse(Request.ServerVariables["SERVER_PORT"], out port) && port != 80)
url += ":" + port;
url += Request.ServerVariables["SCRIPT_NAME"];
return url.Substring(0, url.LastIndexOf("/") + 1);
}