Rory McCrossan
Rory McCrossan

Reputation: 337560

Azure Notification Hub installation not updating tags

I am attempting to update the tags of an installation within Azure Notification Hub after registration. I am following several guides for this, notably here and here.

Both of these guides suggest that the following code should work however it is plainly not; the tag never gets updated. There are no errors, and I can guarantee that the installationId is correct. I am guessing I am setting the path/value of the tag incorrectly.

// in constructor:
var _notificationHub = NotificationHubClient.CreateClientFromConnectionString(Settings.ConnectionStrings.NotificationHub, Settings.Defaults.NotificationHubName);


// in WebApi endpoint:
var installationUpdates = new List<PartialUpdateOperation>();
var userDetail = _userDetailRepo.Get(id);

installationUpdates.Add(new PartialUpdateOperation
{
    Operation = UpdateOperationType.Replace,
    Path = "/tags/interestedin", // is this incorrect?
    Value = interestedIn.ToUpper()
});
userDetail.InterestedIn = interestedIn;

await Task.WhenAll(
    _userDetailRepo.InsertOrReplace(userDetail),
    _notificationHub.PatchInstallationAsync(installationId, installationUpdates));

Here is the installation object's tags, as per VS:

enter image description here

I also tried hardcoding the path to Path = "/tags/interestedin:W" but it made no difference.

Can someone tell me if I am doing something wrong here, and if so how I should amend my code. Thanks.

Upvotes: 2

Views: 817

Answers (1)

efimovandr
efimovandr

Reputation: 1604

Unfortunately, Path = "/tags/interestedin" is not going to work as of now. We are currently working on wildcards' support. Once it is done, something like "/tags/interestedin*" will work fine for you.

While Path = "/tags/interestedin:W" should be OK. If you could provide namespace name, hub name, and a timeframe, then I'll take a look at logs to check what is going on there.

Upvotes: 4

Related Questions