c# - Set time limit for items in container in CosmosDB using Microsoft.Bot.Builder.Azure (bot framework v4)


Question: 

I want to set the time to live for the items in a container in cosmosDB, but I am not sure how to do so using the config of cosmosdb storage in bot framework v4. I would appreciate some help on this matter.

I have read about setting time to live using DocumentClient() as documented here. However I set up my storage like this:

var storage = new CosmosDbStorage(new CosmosDbStorageOptions
        {
            AuthKey = CosmosDBKey,
            CollectionId = CosmosDBCollectionName,
            CosmosDBEndpoint = new Uri(CosmosServiceEndpoint),
            DatabaseId = CosmosDBDatabaseName,
        });

How can I set time to live with this config of my cosmosDB storage?




1 Answer: 

BotBuilder SDK doesn't currently allow you to create a Collection with DefaultTimeToLive.

However, you can do so in the Azure Portal once your Collection has been created and then set it:

  1. Open the Azure Portal
  2. Go to your Resource Group
  3. Open your CosmosDB Service
  4. On the left, go to Data Explorer
  5. Expand your Database
  6. Expand your Collection
  7. Click Scale & Settings
  8. Adjust Settings > Time to Live

    enter image description here

 

More Articles


How To Get Alexa Ranking In Java

I tried to use Java and DOM XML parser to get the Alexa ranking from below :http://data.alexa.com/data?cli=10&url=domainNameIs there any API for Alexa ranking and other useful for particular URL ?

Magento EBS payment gateway - upon redirection shows 404 page

I have developed a store and using EBS payment gateway for netbanking. It was working fine but suddenly it started showing a 404 page not found error upon redirection. After clicking confirm order the customer is never directed to the EBS page but remains on the site with the page not found message!

facebook - Unable to publish an action

I'm attempting to create a Facebook Open Graph App similar to the Washington Post Social Reader, which will announce in a person's news feed when they read an article on my website, www.zeitlife.co.uk.I have followed the Open Graph tutorial closely, identifying an action and an object, and creating


javascript - Sending HTTP Requests Through Azure

I am trying to interact with Urbanairship via their broadcast API to send notifications to android devices on an INSERT into a Azure table.My JavaScript INSERT code on Azure is as follows: function insert(item, user, request) { request.execute({ success: function() {

Azure DNS hostname or IP reference in web.config?

When connecting to Azure services in my applications, is it preferable to use the DNS hostname or the IP?For example, I have a SQL Server hosted in a virtual machine. Should I configure my web.config with 168.63.xxx.xxx or with mysqlserver001.cloudapp.net?Thanks

c# - How to connect with bot from another app?

I have created a core bot with basic workflow to collect information from end-users, which is hosted on http://localhost:3978, and exposes an endpoint to send message http://localhost:3978/api/messages (POST) I can start and chat with bot via Bot Framework Emulator, but I dont know how to interact w


c# - Microsoft Bot Framework works locally, but fails remotely

I have this bot that is fairly complicated, but it works locally. But as soon as I publish it, it fails with the error: Sorry, my bot code is having an issue.I have tried using Application Insights, but it isn't showing the error details.The error always happens at the same point:/// <summary>

java - How to integrate KNET payment gateway with php

How can I integrate the KNET payment gateway with PHP? The gateway id only works with Java and .NET.

android - Google Actions does not work from OK Google. my app is not recognised

I have downloaded this basic example from google: https://github.com/actions-on-google/appactions-fitness-kotlinNow if I do: adb shell am start -a android.intent.action.VIEW -d "https://fit-actions.firebaseapp.com/start"It will start my app. And the deeplink is being recognized.The example shows tha

payflowpro - How to use paypal payflow api to charge sale in canadian dollars

I have a custom application that is integrated with the paypal payflow API. We are expanding to Canada and would like to charge in the Canadian dollar for our Canadian customers but it keeps defaulting to the US Dollar.I'm trying to pass 'CURRENCY'=> 'CAD' in the REST call via curl. I can't find a