We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Handling special char in Aspose

Hi

I have a folder ($All) is Aspose can handle special character.Because i got Format exception.

Hi Pooja,


I tried to reproduce this issue at my end using the following lines of code, but couldn’t get success. The code executes fine and the output PST can be read again. Could you please share your code sample with us alongwith some sample PST that we could use to reproduce this issue at our end? We’ll look into it and assist you further as soon as possible.

Sample Code:

PersonalStorage pst = PersonalStorage.Create(“Sample.pst”, FileFormatVersion.Unicode);<o:p></o:p>

FolderInfo folderInfo = pst.RootFolder.AddSubFolder("$All");

folderInfo.AddMessage(MapiMessage.FromFile("About Aspose-1.msg"));

pst.Dispose();

pst = PersonalStorage.FromFile("Sample.pst");

FolderInfo fi = pst.RootFolder.GetSubFolder("$All");

MessageInfoCollection coll = fi.GetContents();

MessageInfo msgInfo = coll[0];

MapiMessage mapi = pst.ExtractMessage(msgInfo);

Hi,

If folder is not created in pst then i want to add it in pst and if it is already created then i want that folder object from pst .I write following code,please check it


FolderInfo FolderInfoObj = null;
String FolderName ="($All)";
PersonalStorage m_ObjPersonalStorage = PersonalStorage.Create(“Sample.pst”,FileFormatVersion.Unicode);

if (!String.IsNullOrEmpty( FolderName))
{
f_FolderInfoObj = m_ObjPersonalStorage.RootFolder.GetSubFolder(p_strSourceFolderPath);

//If this GetSubFolder() method is called repedatedly for the same folder name then it give null reference exception
if (f_FolderInfoObj == null)
{
f_FolderInfoObj = m_ObjPersonalStorage.RootFolder.AddSubFolder(f_temp);
}
}

Hi Pooja,


If you are creating a PST, then its for sure that the PST won’t be having any such folder. I think you are mixing the issue. Please elaborate your requirements so that we can assist you in the right direction and to the point.

Hi,

Folder are created successfully…Thank you so much…
I have also another problem that,if i dont have eml or msg but i have a object who has properties like To,CC,BCC,but they are string property so can i assign to MailMessage To,CC,Bcc property.
Please reply soon.

Hi Pooja,

Using MailMessage, you can simply assign such information to various properties of this class as you can see in the detailed example HERE. Please let us know if we can be of any additional help to you in this regard.

//Declare message as MailMessage instance

MailMessage message = new MailMessage();
//txtFrom.Text is the sender’s address

message.From = "from@domain.com";

//txtTo.Text is the recipient’s address

message.To = "to@domain.com";

message.Subject = “My First Mail”;

//txtBody.Text is the email message

message.TextBody = “Message text body”;