I have a service that manages all of the indexes/indxers I use for Azure Cognitive Search, and within that I am attempting to set disableOrderByHighWaterMarkColumn to true when creating/updating an indexer.
While I do see examples in the official docs for an HTTP request to set that field, I'm not seeing any parameter anywhere (including the Parameters option under the SearchIndexer object) that can be set to update that value.
Does nadisableOrderByHighWaterMarkColumn` through the C# API? I have the latest Azure.Search.Documents package installed.
You would need to add it as a custom key under the SearchIndexer.Parameters.IndexingParametersConfiguration property.
If for some reason that doesn't work as expected, then it is a bug with the .NET SDK that I would suggest you submit as an issue against the official Github repository.
Related
I am trying to query Watson Discovery News and get some responses in Unity.
First I tried to authenticate my Watson Discovery service through Discovery service APIKey(As described in the "IAM" section in https://github.com/watson-developer-cloud/unity-sdk). My code is exactly the same as the example code in "Query a collection" section in https://cloud.ibm.com/apidocs/discovery/discovery?code=unity#query-a-collection.
Unfortunately, the code always returns due to unsuccessful authentication, thus I cannot get any response. After some debugging, I found out that "tokenData" field in IamAuthenticator.cs(This is part of IBM Unity SDK) is not initialized; this leads to the unsuccessful authentication.
I was able to debug by changing the "yield return" in example code to "return". Otherwise, C# debugger cannot step into the code.
Since I have followed all the steps in IBM documentations, I am not sure how to proceed.
To reproduce the problem, one has to download IBM Unity SDK on https://github.com/watson-developer-cloud/unity-sdk and follow the instructions in README. After setting up, one could replicate the problem using the code below:
var authenticator = new IamAuthenticator(
apikey: "{apikey}"
);
while (!authenticator.CanAuthenticate())
yield return null;
Thanks in advance for any help!
Have you set the URL (SetServiceUrl) to match the location for your service instance? See Service Endpoint in the API reference
I bypassed this problem using Token authentication instead of using APIkey.
If one has the choice of using other SDKs, e.g. Java SDK, please do so. Because Watson Unity SDK is not well supported at the moment.
I tried to get the content of the user's profile picture and I found out that I had to call the Beta version because the current version gives the following error message:
"code": "GetUserPhoto",
"message": "The operation is not supported."
So, I tried to switch to Beta, and here is the code that I wrote in C# to do it, but it doesn't work:
Microsoft.Graph 1.6.2
List<QueryOption> options = new List<QueryOption>
{
new QueryOption("$api-version", "beta")
};
var pictureStream = await graphClient.Me.Photo.Content.Request(options).GetAsync();
I got the same error message.
I tried the same request in the Graph Explorer. The 1.0 doesn't work, but Beta works.
The api-version query parameter is used by the Azure AD Graph API. This is a different API than Microsoft Graph. There is a lot of functional overlap (Azure AD Graph is slowly being migrated over to Microsoft Graph) but they use entirely different entities and calling conventions.
In order to call the /beta endpoint using the Microsoft Graph .NET Client Library, you need to change the BaseUrl of the client:
graphClient.BaseUrl = "https://graph.microsoft.com/beta";
var pictureStream = await graphClient.Me.Photo.Content.Request().GetAsync();
Some important notes about the /beta endpoint:
It isn't supported and isn't suitable for production. So don't do that. Or at least don't tell anyone and don't call Support if it stops working. ;-)
The .NET Client uses objects constructed off the production metadata. This means that any entities, actions or properties that were added in /beta don't exist in the models shipped with the SDK.
The .NET Client will ignore any values returned by Microsoft Graph that it doesn't expect to see. So if an endpoint returns a property that wasn't included in the production metadata (see #2), it will simply be ignored.
So long as you're only using a /beta to gain functionality but still expecting /v1.0 results, it should work okay. Photos for example only look at Exchange in v1.0 but look in both Exchange and Active Directory but still return the same result. In theory this means you should be able to swap /beta for /v1.0 without a problem.
I think you are still calling V1 endpoint. In fact, the Beta endpoint is not currently supported in the Microsoft Graph .NET Client Library. More info here.
There is an official beta client for Graph API now:
https://github.com/microsoftgraph/msgraph-beta-sdk-dotnet
Trying to use custom application configuration in my service. This post gives part of the answer, but it doesn't explain how & where you initialize the ServiceInitializationParameters object, which is required to get it working. The object does not seem to have a constructor. Documentation from Microsoft is sketchy and the provided sample on GitHub does not seem to use any custom app config.
This post is based on the preview SDK. In the release version (2.0+) of the SDK, ServiceInitializationParameters was replaced with ServiceContext and its derived stateless and stateful versions. Check out the release notes for a comprehensive list of all the changes from preview to release.
Everything else in this post is still accurate, but you access the config stuff like this now:
var configurationPackage = this.Context.CodePackageActivationContext.GetConfigurationPackageObject("Config");
var connectionStringParameter = configurationPackage.Settings.Sections["UserDatabase"].Parameters["UserDatabaseConnectionString"];
According to the rest api documentation it is recommended to assign a payer_id when saving a card to the vault.
My problem is that there is no payer_id property to populate for the creditCard object in the first place.
creditCard.number = "4417119669820331";
creditCard.expire_month = "11";
creditCard.expire_year = "2018";
creditCard.first_name = "Joe";
creditCard.last_name = "Shopper";
creditCard.type = "visa";
**creditCard.payer_id = "123456789";**
As far as I am aware I am using the latest APIs updated by Nuget in VS2012.
Here's the response from the PayPal Vault API team:
The payer_id field was never removed. We've intended to deprecate/discourage its use because we determined that this field was misleading in the way it was named - it was being mistaken for a PayPal's internal identifier, where in reality, to PayPal, it was just an arbitrary string, intending to identify an externally managed customer id. The Vault team has since added a field named external_customer_id that better captures the intent.
The external_customer_id property (found here in the current version of the SDK) is what should be used instead. However, since the payer_id property will continue to be supported in the v1 version of the Vault REST services, the .NET SDK will continue to provide support for this (the upcoming v1.1 .NET SDK release will include it again).
The PayPal documentation team is working on getting the public documentation for the credit card object updated to include this information.
For future reference by other developers who may find this post, I'd like to add that if you do find a property missing from the PayPal .NET SDK, a better place to report this is to open an issue on the PayPal .NET SDK GitHub repository where the code for the SDK resides.
Can you guys show me how to retrieve instanceId, dns public name and type of current EC2 instance from where I'm running the code...
I'm playing with DescribeInstanceAttribute(), but it needs to supply the instanceId to the request, and I can't find how to get the id of currently running instance.
There's a much easier method than making a web API call, the .NET SDK.
See the SDK documentation for EC2InstanceMetadata here
For example, if you need InstanceId you can use:
Amazon.Util.EC2InstanceMetadata.InstanceId.ToString();
All the other properties are available in a similar manner.
Note that the SDK used to have Amazon.EC2.Utils - this was deprecated in 2015 and moved to Amazon.Util namespace
There's a webservice that returns machine information. Access
http://169.254.169.254/latest/meta-data/instance-id
To retrieve the instance id
The Instance Metadata Documentation can be handy.
You can also use AWS's Dot Net SDK for example Amazon.EC2.Util.EC2Metadata.InstanceId.ToString();