[Question] How to open file using Actions.OpenUrl?
I want to open a file from a button on a hero card. Why does using file:///...file or network location... not seem to work? Here is my code:
var helpHeroCard = new HeroCard {
Title = "Build Location",
Buttons = new List<CardAction> {
new CardAction(ActionTypes.OpenUrl , "\\\\DUMMY_SERVER\\" , value: "file:\\\\DUMMY_SERVER\\")
}
};
helpMsg.Attachments.Add(helpHeroCard.ToAttachment());
await context.PostAsync(helpMsg);
Thanks!
can you please share the code in order to repro?
Sorry I'm new to this. Do you mean upload my code to github? I just wanted to know if there's a way to open a file or network connection from a HeroCard button. When I hover over it in visual studio I can CTRL+ to get to the server so I know the link is formatted right. I can't share any of my code for privacy reasons.
you can choose to upload it to GitHub or you could upload it to onedrive and share the link.
Its what's mentioned in the orig post:
[LuisIntent("Help")]
public async Task showBotInformation(IDialogContext context, LuisResult result)
{
var helpMsg = context.MakeMessage();
var helpHeroCard = new HeroCard {
Title = "Build Location",
Buttons = new List<CardAction> {
new CardAction(ActionTypes.OpenUrl , "\\\\DUMMY_SERVER\\" , value: "file:\\\\DUMMY_SERVER\\")
}
};
helpMsg.Attachments.Add(helpHeroCard.ToAttachment());
await context.PostAsync(helpMsg);
}
@msmohan Any idea how I can accomplish this? Thanks for the help.
@meganlcooper can you share your code in GitHub or Onedrive?
@meganlcooper can you please explain on "DUMMY_SERVER" ? is it your local pc? or network share?
@msmohan Sorry, it is network share. Also I added context for the var helpMsg. An example of the format for the server link would be file:\//mynetwork-example/
@meganlcooper
You can host the file in local webserver instead. Using ActionTypes.OpenUrl or DownloadFile, update your code as shown below
Buttons = new List
Network share is not supported in this context.
Do the ActionTypes.OpenUrl or DownloadFile support Data URL protocol? i.e. data: