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

Free Support Forum - aspose.com

How to access Task details?

Hi


I want to access the details of Task which is saved on disc. This detail is Mileage, Billing information and Company Name. How to access this information using MapiTask??

Hi Cornelius,


I have analyzed the scenario and found that currently complete detail information is not available in MapiTask. You need to get information from MaipMessage and MapiTask both. Please give a try to the following code which provides detailed information like Date completed, Total work, Actual work, Mileage and Billing information.

MapiMessage msg = MapiMessage.FromFile(“Task.msg”);
MapiTask task = (MapiTask)msg.ToMapiMessageItem();

//Date Completed
DateTime DateCompleted = task.DateCompleted;

//Total Work (Hours)
int EstimatedEffortHours = task.EstimatedEffort;

//Actual Work
int ActualEffortHours = task.ActualEffort;

//Mileage
string Mileage = msg.Properties[2152398879].GetString();

//Billing Information
string BillingInformation = msg.Properties[2152464415].GetString();

Please feel free to write us back if you need any other assistance.

How do you access BillingInformation in VB.Net for a .msg file?


I have this code:

Dim msg As New Aspose.Email.Mail.MailMessage()

msg = Aspose.Email.Mail.MailMessage.Load(Email, Aspose.Email.Mail.MessageFormat.Msg)

But can’t find any access to BillingInformation

Hi Stephen,


Thanks for writing to Aspose.Email support team.
Could you please give a try to the following code which extracts billing information from MSG file and displays the result.

Dim msg2 As New MapiMessage()
Dim msg As MapiMessage = MapiMessage.FromFile(“D:\Aspose\Task.msg”)
Dim task As MapiTask = DirectCast(msg.ToMapiMessageItem(), MapiTask)

'Date Completed
Dim DateCompleted As DateTime = task.DateCompleted

'Total Work (Hours)
Dim EstimatedEffortHours As Integer = task.EstimatedEffort

'Actual Work
Dim ActualEffortHours As Integer = task.ActualEffort

'Mileage
Dim Mileage As String = msg.Properties(&H804B001FUI).GetString()

'Billing Information
Dim BillingInformation As String = msg.Properties(&H804C001FUI).GetString()

Please feel free to write us back if you have any other query in this regard.

How do I set BillingInformation value?

Hi Stephen,


Could you please give a try to the following code which sets the billing information and then saves the message on disc?

Dim msg2 As New MapiMessage()
Dim msg As MapiMessage = MapiMessage.FromFile(“D:\Aspose\Task.msg”)
Dim task As MapiTask = DirectCast(msg.ToMapiMessageItem(), MapiTask)

'Date Completed
Dim DateCompleted As DateTime = task.DateCompleted

'Total Work (Hours)
Dim EstimatedEffortHours As Integer = task.EstimatedEffort

'Actual Work
Dim ActualEffortHours As Integer = task.ActualEffort

'Mileage
Dim Mileage As String = msg.Properties(&H804B001FUI).GetString()

'Get Billing Information
Dim BillingInformation As String = msg.Properties(&H804C001FUI).GetString()

'Set Billing Information
BillingInformation = “420$”

Dim prop As New MapiProperty(&H804C001FUI, System.Text.Encoding.Unicode.GetBytes(BillingInformation))
msg.SetProperty(prop)
msg.Save(“D:\Aspose\Task2.msg”)

This does not appear to work for me. See my code below:

Dim msg As Aspose.Email.Outlook.MapiMessage = Aspose.Email.Outlook.MapiMessage.FromFile(txtCorrespondenceLoc.Text)

Dim BillInfo As String = "" + txtCorrespondenceLoc.Text + "True"

If Not String.IsNullOrEmpty(txtCorrPropertyID.Text) Then


BillInfo = BillInfo + “” + txtCorrPropertyID.Text + “”


End If

If Not String.IsNullOrEmpty(txtCorrClientID.Text) Then


BillInfo = BillInfo + “” + txtCorrClientID.Text + “”


End If

If Not String.IsNullOrEmpty(txtCorrEnquiryID.Text) Then

BillInfo = BillInfo + “” + txtCorrEnquiryID.Text + “”


End If

Dim prop As New Aspose.Email.Outlook.MapiProperty(&H804C001FUI, System.Text.Encoding.Unicode.GetBytes(BillInfo))

msg.SetProperty(prop)


Dim TempFile As String = System.IO.Path.GetTempFileName + “.msg”


msg.Save(TempFile)


msg.Dispose()


Process.Start(TempFile)

Also, all the internet header information is being lost and I need to keep it.

I think fixed the Internet Header problem by changing:

FromFile(txtCorrespondenceLoc.Text)

to

FromMailMessage(txtCorrespondenceLoc.Text)

But still no BillingInformation

Hi,

sswavley:

This does not appear to work for me. See my code below:

Could you please explain what problem you are facing with the code sample that I provided you earlier? I have checked the output file Task2.msg and the billing information is available in the output file as you can see in the attached screenshot. Please provide us more information about the problem you are facing in this regard (with the help of screenshots if possible) so that we can assist you further.