cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
fei_css
Level 3

Change Download Location

I use following codes to check updates and download available updates. It seems working fine to me. However I would like to change download target location before I start downloading, i.e before UpdateInstance.Download(True). I cann't find a property to do this. Is there any property I can set and let me download the files to my designated folder?

Thanks for your help

fei_css

Dim UpdateAgent As DWUpdateServiceLib.Agent = New DWUpdateServiceLib.Agent()
Dim UpdateCollection As DWUpdateServiceLib.Updates
Dim pszProductCode As String = "{094E330A-45A1-4277-9DE8-8EE79E698FC8}"

If UpdateAgent.IsConnectedEx(pszProductCode) Then
UpdateCollection = UpdateAgent.EnumUpdates(pszProductCode)
UpdateInstance = UpdateCollection.Item(UpdateCollection.Count)
UpdateInstance.Download(True)
End If
0 Kudos
(5) Replies
Ritesh
Level 4

You can do this before Download:

UpdateInstance.SetValue(DownloadURL, "C:\\downloadedApps")

If this method is not available, then you need to download the latest version of the client files (agent.exe).
0 Kudos
fei_css
Level 3

Ritesh,

First thanks for helping me on this problem.

But does it work? I keep getting 404 error. Also, I use this to see the previous value of DownloadURL:
Debug.WriteLine(UpdateInstance.QueryValue(DWUpdateServiceLib.UpdateProperty.DownloadUrl).ToString)

It tells me the URL that holds my updates. So based on your suggestion, if I change this property, how come update agent knows where available update is? I am really confusing....

fei_css

Ritesh wrote:
You can do this before Download:

UpdateInstance.SetValue(DownloadURL, "C:\\downloadedApps")

If this method is not available, then you need to download the latest version of the client files (agent.exe).
0 Kudos
Ritesh
Level 4

On the Publisher's web site, when you created the update, you specified the location of the update (step 2).

The agent retrieves this information when you call EnumUpdates.

Before calling the Download method, you can call the SetValue method to set a different location of the update (DownloadUrl property). The agent will use that for the location of where to download from.

My example I posted earlier is a bit incorrect. It should be like

UpdateInstance.SetValue(DownloadUrl, "http://www.mycompany.com/myupdate.exe")



fei_css wrote:
Ritesh,

First thanks for helping me on this problem.

But does it work? I keep getting 404 error. Also, I use this to see the previous value of DownloadURL:
Debug.WriteLine(UpdateInstance.QueryValue(DWUpdateServiceLib.UpdateProperty.DownloadUrl).ToString)

It tells me the URL that holds my updates. So based on your suggestion, if I change this property, how come update agent knows where available update is? I am really confusing....

fei_css
0 Kudos
KellyF
Level 9

fei_css,

Out of curiosity, when you said change the "download location" you were referring to the _source_ from which you'd be downloading your executable, right? If so, then yes, Ritesh is spot-on. :cool:

If you're looking to just change the _target_ download location, then I would need to ask why. The agent would download your executable and run it, so where it downloads is irrelevant.

Regards,
Kelly
0 Kudos
fei_css
Level 3

Kelly,

Thanks for pointing out that. I mislead Ritesh. I hope it is clear to everybody right now. 😉

In my project, I don't want to install msi right away until some thing happens. But I don't want to hold downloading either. I really want to download update or patch as soon as it is availabe in the server. I will control when to install it. Is this possible?

Thanks for any suggestions.

fei_css
0 Kudos