Reputation:
i have written the following event handler code to update a column in the document library, on checkin of a document:
Select Case listEvent.Type
Case SPListEventType.CheckIn
sLog = sLog + "Newest Item is Checked-out" + vbCrLf
Dim ApproveStatusBoolean As Boolean = True
For Each oField In oItem.Fields
If (oItem("ApproveStatus") = "Rejected") Then
ApproveStatusBoolean = False ' Old document for re-review
Exit For
End If
Next
If (ApproveStatusBoolean = False) Then
oItem("ApproveStatus") = "Submitted"
oItem.Update()
SmtpMail.Send(objMailMesg)
End If
End Select
I find that the ApproverStatus column is getting updated if i checkin the document from the document library but it is not happening if i checkin the document from inside the word document when it promts for "other users cannot see your changes untill you checkin. do u want to checkin?".
can you please help me to know what is going wrong how to get the column updated if i checkin from inside also.
or is there any way by which i can turn off that prompt itself.
Upvotes: 1
Views: 676
Reputation: 14295
There may also be an issue with your code. Try the following...
Select Case listEvent.Type
Case SPListEventType.CheckIn
sLog = sLog + "Newest Item is Checked-out" + vbCrLf
If (oItem("ApproveStatus") != "Rejected") Then
oItem("ApproveStatus") = "Submitted"
oItem.Update()
sLog = sLog + "Item has set to ApproveStatus:Submitted" + vbCrLf
SmtpMail.Send(objMailMesg)
End If
End Select
You are also going to have different results if you use a non-office document or an office 2003 document. You will have to test these as well. Be aware that using a synchronous event with Office 2007 documents may lead to the event being called, but subsequently being overwritten by the old value stored within the office document itself.
Upvotes: 0
Reputation: 1708
The first thing you should do is to varify that the same event is fired in both cases. I would do that by writing some debug statements to a log file, but I am also kind of ol' school. If I was to debug that code I would outcomment most of the code like the SMTP mail statement in order to raise the signal to noise ratio.
Once that is handled you can dig into the root cause
Upvotes: 1