stormbreaker
stormbreaker

Reputation: 848

Recognizing new or already known document with VSTO

I've never worked with VSTO and I've recently read all kinds of stuff about it. So I ask a theoretical question. I'm trying to make an addin which should (using buttons in it's own ribbon tab) upload the document to my website (it's like slideshare). The problem is that this file may be already uploaded and the user may be just trying to update it.

So I need a way to tell if this file has already been uploaded. I know the prediction can't be 100% accurate, that's why I'm going to ask the user with a dialog, but I need it to be fairly clever to alert the user if the file MAY BE is already uploaded.

This assumption can be client-side only, with a database of some sort (in the addin itself). I thought of recording the file's name and based on this I can decide if the file is new or it's already uploaded.

Do you have any other ideas? Maybe there's more clever way to do this?

PS. Working on Office 2010 with the latest version of VSTO in VS 2010. My main .net language is VB but samples in C# are more than welcome (if you have ones).

Upvotes: 0

Views: 261

Answers (2)

Steve Rindsberg
Steve Rindsberg

Reputation: 3528

You can use Custom Properties but in PPT I'd use tags instead; the user can't see/meddle with them.

Assuming a reference to your presentation in oPres

With oPres
    .Tags.Add "Uploaded", "YES"
    .Tags.Add "LastUploadDate", "some string you've formatted to taste"
    .Tags.Add "AnythingElse", "You'd like to record"
End With

and

With oPres
    If .Tags("Uploaded") = "YES" Then
        ' nothing to do
    Else
        ' upload it
    End If
End With

Upvotes: 1

DarinH
DarinH

Reputation: 4879

What i'd probably do in that case is add a DOCUMENT VARIABLE or DOCUMENT PROPERTY with a value of a GUID.

Then when you push the file, the server could extract that property, get the guid and easily perform a lookup to see if the doc is already there.

At least, that'd be another way (other than say, user and filename) to id the document.

Upvotes: 2

Related Questions