Sharepoint checkin/checkout and refresh

my question is if anyone nows how to refresh modifed files in sharepoint so i dont have to wait to attach modified files.

I have an application that updates a worddocument on the users filesystem

and mail it as an attachment afterwards.

It works if the user choose a word file outside sharepoint.

The agent modifies and add values to the worddocument, saves it and mails the worddocument.

no problems.

If i choose a document in sharepoint the old worddokument is sent.

But when i check the file in sharepoint its modified correctly.

If i add a sleep for 30 sec after i save/checkin in the word document the new/updated worddocument is sent.

Ive tried solutions where ive opened the wordddoc again with lotusscript to see if it has been updated:

Set appWrd = Nothing

set appwrd = CreateObject(“Word.Application”)

Set docCurrent = Nothing

Set docCurrent = appWrd.Documents.Open(docPath)

endloop=“”

While endloop=“”

docCurrent.Bookmarks(“TelemMeddnr2”).Select

If(appWrd.Selection.Text = “” Or appWrd.Selection.Text = " ") Then

'not modified

Else

'modified

endloop="true"

End If

Wend

But everything is set when i check the above code but when i attach it with:

Call rtitem.EMBEDOBJECT(EMBED_ATTACHMENT, “”, files)

its empty.

the only thing that works right now is to wait 30 sec until i attach the modified documents from sharepoint.

Subject: sharepoint integration code

My code for checkin and checkout worddocuments in sharepoint:

'checkout

If docCurrent.CanCheckin()=True Then SharePoint=“yes” ’ if doc in sharepoint is checkdin by currentuser set flag (so we check it in after modification).

’ checkout if sharepoint and is not checkout

If (appWrd.ActiveDocument.ReadOnly) Then

appWrd.ActiveDocument.Close

appWrd.Documents.CheckOut (docPath)

Set docCurrent =appWrd.Documents.Open(docPath)

SharePoint=“yes” ’ set flag that this is a sharpointdoc.

End If

'checkin

If SharePoint=“yes” Then

appwrd.ActiveDocument.CheckIn True,“aaa”,True

end if

Until i or someone solved the refresh after the checkin my temp solution is to add a sleep before i send the modified sharepointdoc.

Subject: the code

I did a simple demo of the code if anyone wants to try theirself. Just put it in a database on an actionbutton in a form. (I dont know if its just in our sharepoint-environment i needto add a timout/sleep after checkin to attach the modified document).

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim rtitem As NotesRichTextItem

Dim object As NotesEmbeddedObject

Const END_OF_STORY = 6

Const MOVE_SELECTION = 0

Set appwrd = CreateObject(“Word.Application”)

Dim checkin,filepath As String

checkin=“”

’ path to worddoc in sharepoint

filepath=“\docs\personal\pages/fa_llk\mydocuments\worddoc.doc”

Set docCurrent = appwrd.Documents.Open(filepath)

If (appwrd.ActiveDocument.ReadOnly) Then

appwrd.ActiveDocument.Close

appwrd.Documents.CheckOut (filepath)

Set docCurrent = appwrd.Documents.Open(filepath)

checkin=“yes”

End If

Set objSelection = appwrd.Selection

objSelection.EndKey END_OF_STORY, MOVE_SELECTION

objSelection.Font.Size = “14”

objSelection.TypeText “” & Date()

objSelection.Font.Size = “10”

objSelection.TypeText “testing to addd some text to sharepoint and checkin doc2!”

objSelection.TypeParagraph

If checkin=“yes” Then

appwrd.ActiveDocument.CheckIn True,“comment”,True

Set docCurrent = appwrd.Documents.Open(filepath)

Else

appwrd.ActiveDocument.Save

appwrd.ActiveDocument.Close

End If

’ attach the worddoc

’ add sleep here to be certain to get the updated doc.

Set db = session.CurrentDatabase

Set doc = New NotesDocument( db )

Set rtitem = New NotesRichTextItem( doc, “Body” )

Set object = rtitem.EmbedObject _

( EMBED_ATTACHMENT, “”, filepath)

doc.Form = “test”

doc.Subject = “Here’s a word doc modified in sharepoint, as an attachment”

Call doc.Save( True, True )

Msgbox “done”

Subject: delay/refresh sharepoint

i dont know if this is the reason why the checkin documents isnt updated instantly.Microsoft Learn: Build skills that open doors in your career

best regards Leon@edgeguide.com