Sujay Ghosh
Posts: 27
Joined: 2010-01-20
|
I am initializing a custom property in ADXOLXtraInfo_ADXAfterFormShow, and saving the user propery with values in ADXAfterFormHide.
Outlook.UserProperty customUserProperty;
private void LoadCustomProperties()
{
customUserProperty = OLMailItem.UserProperties.Item("SPCustomProperty");
if (customUserProperty == null)
{
customUserProperty = OLMailItem.UserProperties.Add("SPCustomProperty", Outlook.OlUserPropertyType.olText, false, string.Empty);
}
}
In the AfterHide event I am saving the property
private void ADXOLXtraInfo_ADXAfterFormHide(object sender, ADXAfterFormHideEventArgs e)
{
StringBuilder sb = new StringBuilder();
if (!string.IsNullOrEmpty(cbxCommSignal.Text))
{
sb.Append(cbxCommSignal.Text.Trim());
sb.Append(",");
}
string customValues = sb.ToString();
// seeing the exception here , when assigning the values
OLMailItem.UserProperties.Item("SPCustomProperty").Value = customValues;
mail.Save();
}
The string customValues are being populated correctly .
The error is " The item has been moved or deleted " https://ctrl.vi/i/4rG2VleLW
Thank you
Sujay |
|
Andrei Smolin
Add-in Express team
Posts: 18614
Joined: 2006-05-11
|
Hello Sujay,
Try to turn off all other controls and check whether the issue is reproducible.
Your code creates a number of COM objects and leaves them unreleased. OLMailItem.UserProperties.Item("SPCustomProperty") chains COM calls and it is recommended that you don't do this. Note that you get OLMailItem.UserProperties.Item("SPCustomProperty") while you already have Outlook.UserProperty customUserProperty holding that COM object.
You create a UserProperty and this modifies the Outlook item. Does your code or the user save the item after all? Does the user or the code close the item? What causes ADXAfterFormHide?
Regards from Poland (GMT+1),
Andrei Smolin
Add-in Express Team Leader |
|
Sujay Ghosh
Posts: 27
Joined: 2010-01-20
|
Hello Andrei ,
Sorry for the very late reply.I was not well for a couple of months .
I solved the issue . The AfterShow event is fired afer ItemSend, and therefore I was seeing the exception . I have another issue shall post a new topic. |
|
Andrei Smolin
Add-in Express team
Posts: 18614
Joined: 2006-05-11
|
Hello Sujay,
Thank you for letting me know.
Hope you are okay now.
Regards from Poland (GMT+1),
Andrei Smolin
Add-in Express Team Leader |
|