Preventing an Outlook mailitem from entering into a conflict
An outlook mailitem is on a network share, and is prone to conflicts especially when modifications are made to it.
The following VBA macro does the following:
- Makes changes to a mailitem
- Checks if the mailitem is saved and saves it.
- Checks the saved mailitem for any conflicts.
How do I modify this code to prevent the mailitem from entering into a conflict in the first place?
Any ideas a welcome.
Sub CheckConflict()
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
Set objMail = olApp.ActiveInspector.CurrentItem
objMail.Subject = "Changing subject and saving mail"
If objMail.Saved = False Then
objMail.Save
End if
If objMail.IsConflict = True Then
Msgbox "Conflict detected!"
End If
Set olApp = Nothing
Set objMail = Nothing
End Sub
vba networking outlook save conflict
add a comment |
An outlook mailitem is on a network share, and is prone to conflicts especially when modifications are made to it.
The following VBA macro does the following:
- Makes changes to a mailitem
- Checks if the mailitem is saved and saves it.
- Checks the saved mailitem for any conflicts.
How do I modify this code to prevent the mailitem from entering into a conflict in the first place?
Any ideas a welcome.
Sub CheckConflict()
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
Set objMail = olApp.ActiveInspector.CurrentItem
objMail.Subject = "Changing subject and saving mail"
If objMail.Saved = False Then
objMail.Save
End if
If objMail.IsConflict = True Then
Msgbox "Conflict detected!"
End If
Set olApp = Nothing
Set objMail = Nothing
End Sub
vba networking outlook save conflict
add a comment |
An outlook mailitem is on a network share, and is prone to conflicts especially when modifications are made to it.
The following VBA macro does the following:
- Makes changes to a mailitem
- Checks if the mailitem is saved and saves it.
- Checks the saved mailitem for any conflicts.
How do I modify this code to prevent the mailitem from entering into a conflict in the first place?
Any ideas a welcome.
Sub CheckConflict()
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
Set objMail = olApp.ActiveInspector.CurrentItem
objMail.Subject = "Changing subject and saving mail"
If objMail.Saved = False Then
objMail.Save
End if
If objMail.IsConflict = True Then
Msgbox "Conflict detected!"
End If
Set olApp = Nothing
Set objMail = Nothing
End Sub
vba networking outlook save conflict
An outlook mailitem is on a network share, and is prone to conflicts especially when modifications are made to it.
The following VBA macro does the following:
- Makes changes to a mailitem
- Checks if the mailitem is saved and saves it.
- Checks the saved mailitem for any conflicts.
How do I modify this code to prevent the mailitem from entering into a conflict in the first place?
Any ideas a welcome.
Sub CheckConflict()
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
Set objMail = olApp.ActiveInspector.CurrentItem
objMail.Subject = "Changing subject and saving mail"
If objMail.Saved = False Then
objMail.Save
End if
If objMail.IsConflict = True Then
Msgbox "Conflict detected!"
End If
Set olApp = Nothing
Set objMail = Nothing
End Sub
vba networking outlook save conflict
vba networking outlook save conflict
asked Nov 16 '18 at 2:16
BarokBarok
508
508
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Minimize the number of times you call Save and do not keep the MailItem object open for any prolonged periods of time.
Dmitry@ How about using a temporary dummy object? objMail_temp = objMail. Make modifications to objMail_temp, then set objMail = objMail_temp, and save objMail (once only) at the end. This way I don't have to worry about crashing objMail since it is not "opened" or "used" at all times. Is this implementable?
– Barok
Nov 16 '18 at 6:00
That won't make any difference - it won't even know (or care) that you are storing a reference to one of its objects in two variables.
– Dmitry Streblechenko
Nov 16 '18 at 14:52
Dmitry@ Alright. How about combining the two [if... end if] clauses into one? if objMail.IsConflict = False AND objMail.Saved = False then objmail.Save. Would this detect and prevent a conflict?
– Barok
Nov 18 '18 at 5:23
Why are you even saving the item? If it is being displayed by Outlook, would it not be the user's prerogative to decide when and if the item needs to be saved?
– Dmitry Streblechenko
Nov 18 '18 at 17:34
Dimitry@ Wait a minute. Are you saying that objMail.save is not necessary in a network-share? Does the exchange server automatically manage modifications made to the item?
– Barok
Nov 19 '18 at 13:47
|
show 3 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53330511%2fpreventing-an-outlook-mailitem-from-entering-into-a-conflict%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Minimize the number of times you call Save and do not keep the MailItem object open for any prolonged periods of time.
Dmitry@ How about using a temporary dummy object? objMail_temp = objMail. Make modifications to objMail_temp, then set objMail = objMail_temp, and save objMail (once only) at the end. This way I don't have to worry about crashing objMail since it is not "opened" or "used" at all times. Is this implementable?
– Barok
Nov 16 '18 at 6:00
That won't make any difference - it won't even know (or care) that you are storing a reference to one of its objects in two variables.
– Dmitry Streblechenko
Nov 16 '18 at 14:52
Dmitry@ Alright. How about combining the two [if... end if] clauses into one? if objMail.IsConflict = False AND objMail.Saved = False then objmail.Save. Would this detect and prevent a conflict?
– Barok
Nov 18 '18 at 5:23
Why are you even saving the item? If it is being displayed by Outlook, would it not be the user's prerogative to decide when and if the item needs to be saved?
– Dmitry Streblechenko
Nov 18 '18 at 17:34
Dimitry@ Wait a minute. Are you saying that objMail.save is not necessary in a network-share? Does the exchange server automatically manage modifications made to the item?
– Barok
Nov 19 '18 at 13:47
|
show 3 more comments
Minimize the number of times you call Save and do not keep the MailItem object open for any prolonged periods of time.
Dmitry@ How about using a temporary dummy object? objMail_temp = objMail. Make modifications to objMail_temp, then set objMail = objMail_temp, and save objMail (once only) at the end. This way I don't have to worry about crashing objMail since it is not "opened" or "used" at all times. Is this implementable?
– Barok
Nov 16 '18 at 6:00
That won't make any difference - it won't even know (or care) that you are storing a reference to one of its objects in two variables.
– Dmitry Streblechenko
Nov 16 '18 at 14:52
Dmitry@ Alright. How about combining the two [if... end if] clauses into one? if objMail.IsConflict = False AND objMail.Saved = False then objmail.Save. Would this detect and prevent a conflict?
– Barok
Nov 18 '18 at 5:23
Why are you even saving the item? If it is being displayed by Outlook, would it not be the user's prerogative to decide when and if the item needs to be saved?
– Dmitry Streblechenko
Nov 18 '18 at 17:34
Dimitry@ Wait a minute. Are you saying that objMail.save is not necessary in a network-share? Does the exchange server automatically manage modifications made to the item?
– Barok
Nov 19 '18 at 13:47
|
show 3 more comments
Minimize the number of times you call Save and do not keep the MailItem object open for any prolonged periods of time.
Minimize the number of times you call Save and do not keep the MailItem object open for any prolonged periods of time.
answered Nov 16 '18 at 2:58
Dmitry StreblechenkoDmitry Streblechenko
42.9k32760
42.9k32760
Dmitry@ How about using a temporary dummy object? objMail_temp = objMail. Make modifications to objMail_temp, then set objMail = objMail_temp, and save objMail (once only) at the end. This way I don't have to worry about crashing objMail since it is not "opened" or "used" at all times. Is this implementable?
– Barok
Nov 16 '18 at 6:00
That won't make any difference - it won't even know (or care) that you are storing a reference to one of its objects in two variables.
– Dmitry Streblechenko
Nov 16 '18 at 14:52
Dmitry@ Alright. How about combining the two [if... end if] clauses into one? if objMail.IsConflict = False AND objMail.Saved = False then objmail.Save. Would this detect and prevent a conflict?
– Barok
Nov 18 '18 at 5:23
Why are you even saving the item? If it is being displayed by Outlook, would it not be the user's prerogative to decide when and if the item needs to be saved?
– Dmitry Streblechenko
Nov 18 '18 at 17:34
Dimitry@ Wait a minute. Are you saying that objMail.save is not necessary in a network-share? Does the exchange server automatically manage modifications made to the item?
– Barok
Nov 19 '18 at 13:47
|
show 3 more comments
Dmitry@ How about using a temporary dummy object? objMail_temp = objMail. Make modifications to objMail_temp, then set objMail = objMail_temp, and save objMail (once only) at the end. This way I don't have to worry about crashing objMail since it is not "opened" or "used" at all times. Is this implementable?
– Barok
Nov 16 '18 at 6:00
That won't make any difference - it won't even know (or care) that you are storing a reference to one of its objects in two variables.
– Dmitry Streblechenko
Nov 16 '18 at 14:52
Dmitry@ Alright. How about combining the two [if... end if] clauses into one? if objMail.IsConflict = False AND objMail.Saved = False then objmail.Save. Would this detect and prevent a conflict?
– Barok
Nov 18 '18 at 5:23
Why are you even saving the item? If it is being displayed by Outlook, would it not be the user's prerogative to decide when and if the item needs to be saved?
– Dmitry Streblechenko
Nov 18 '18 at 17:34
Dimitry@ Wait a minute. Are you saying that objMail.save is not necessary in a network-share? Does the exchange server automatically manage modifications made to the item?
– Barok
Nov 19 '18 at 13:47
Dmitry@ How about using a temporary dummy object? objMail_temp = objMail. Make modifications to objMail_temp, then set objMail = objMail_temp, and save objMail (once only) at the end. This way I don't have to worry about crashing objMail since it is not "opened" or "used" at all times. Is this implementable?
– Barok
Nov 16 '18 at 6:00
Dmitry@ How about using a temporary dummy object? objMail_temp = objMail. Make modifications to objMail_temp, then set objMail = objMail_temp, and save objMail (once only) at the end. This way I don't have to worry about crashing objMail since it is not "opened" or "used" at all times. Is this implementable?
– Barok
Nov 16 '18 at 6:00
That won't make any difference - it won't even know (or care) that you are storing a reference to one of its objects in two variables.
– Dmitry Streblechenko
Nov 16 '18 at 14:52
That won't make any difference - it won't even know (or care) that you are storing a reference to one of its objects in two variables.
– Dmitry Streblechenko
Nov 16 '18 at 14:52
Dmitry@ Alright. How about combining the two [if... end if] clauses into one? if objMail.IsConflict = False AND objMail.Saved = False then objmail.Save. Would this detect and prevent a conflict?
– Barok
Nov 18 '18 at 5:23
Dmitry@ Alright. How about combining the two [if... end if] clauses into one? if objMail.IsConflict = False AND objMail.Saved = False then objmail.Save. Would this detect and prevent a conflict?
– Barok
Nov 18 '18 at 5:23
Why are you even saving the item? If it is being displayed by Outlook, would it not be the user's prerogative to decide when and if the item needs to be saved?
– Dmitry Streblechenko
Nov 18 '18 at 17:34
Why are you even saving the item? If it is being displayed by Outlook, would it not be the user's prerogative to decide when and if the item needs to be saved?
– Dmitry Streblechenko
Nov 18 '18 at 17:34
Dimitry@ Wait a minute. Are you saying that objMail.save is not necessary in a network-share? Does the exchange server automatically manage modifications made to the item?
– Barok
Nov 19 '18 at 13:47
Dimitry@ Wait a minute. Are you saying that objMail.save is not necessary in a network-share? Does the exchange server automatically manage modifications made to the item?
– Barok
Nov 19 '18 at 13:47
|
show 3 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53330511%2fpreventing-an-outlook-mailitem-from-entering-into-a-conflict%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown