I am currently building C# applications that talk to SharePoint 2013 using Microsoft.SharePoint.Client.
One requirement I have is to access Microsoft.AnalysisServices.SharePoint.Integration.DataRefreshSchedule to change this. Searching through google I have found a couple of solutions that use the old Microsoft.Sharepoint.dll which does not help me.
The first part of this solution runs the following:
(GeminiServiceApplicationProxy)SPServiceContext.GetContext(sPSite).GetDefaultProxy(typeof(GeminiServiceApplicationProxy))
Put simply I'd like to run this using ClientContext instead. A command like:
ClientContext c = get the context
c.GetDefaultProxy(typeof(GeminiServiceApplicationProxy))
Alas I cannot see a way to do this.
I have two key questions:
How can i access the DataRefreshSchedule using ClientContext or
How can I get the default proxy using ClientContext.
Related
I am trying to find the relevant C# API for Powershell's Get-ADDomain. I don't want to invoke the Powershell commands in C#. Instead I am looking for one or multiple C# API with which I can retrieve all the values.
Get-ADDomain -Identity user.com
I tried searching through DOT net API's but couldn't find a relevant one. I found Domain class. But I am not sure how to get all the info using GetDomain
System.DirectoryServices.ActiveDirectory.Domain.GetDomain(DirectoryContext)
Can someone help in finding the relevant C# API that I can use to retrieve all the values of Get-ADDomain?
If you want to get the domain info for the domain that the computer is a member of or the domain that the user running the script is a member of (if they are the same, flip a coin), you can use a different method on the same class you're already trying to use:
For computer's domain:
[System.DirectoryServices.ActiveDirectory.Domain]::GetComputerDomain()
For user's domain:
[System.DirectoryServices.ActiveDirectory.Domain]::GetUserDomain()
...yes it's in PowerShell but just invoke the either of the two methods above and they internally pass in the DirectoryContext relative to what you're looking for.
You might also get more information you're looking for by going up to the forest and retrieving that info as well:
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()
Hello and thanks for reading my question.
I'm working on transitioning some code from Google.Cloud.Translation.V2 to Google.Cloud.Translate.V3 because we need to make use of the api advanced features.
We are using a TranslationClient to get us the translations (from the V2 library) but we need to instead use the TranslationServiceClient (from the V3 library.)
I'm having trouble instantiating a TranslationServiceClient with our credentials. The way to do it in V2 is straightforward:
TranslationClient.Create(GoogleCredential.FromJson("{\"the credentials\"}"));
From reading the documentation it is clear to me that to create a TranslationServiceClient without the default settings you need to use a TranslationServiceClientBuilder and give that the credentials. I couldn't find any examples, all of the code snippets use TranslationServiceClient.Create() which doesn't allow for any arguments.
Since the goal is to create a TranslationServiceClient using a json as authentication, one way to do this is as follows:
TranslationServiceClient client = new TranslationServiceClientBuilder {
JsonCredentials = "{\"the credentials\"}"
}.Build()
More info at https://cloud.google.com/docs/authentication/production#passing_the_path_to_the_service_account_key_in_code
I am trying to get MailboxSettings of the currently logged in user ("/me") using the .net graph client.
I have a working solution, using an extension method that uses "/me/mailboxSettings", but I have found out that extension methods are not easy to test, though possible, and would prefer a solution that works without one.
I have found out that using Me.Request().Select("MailboxSettings") should work as well but I get a service exception with "Access denied" using the same authentication, which has these permissions : "(...) MailboxSettings.Read User.Read User.ReadBasic.All"
Testing with the graph explorer shows that the request does generally work, though I am not sure if this is because it has more permissions as our app on azure - specfically MailboxSettings.ReadWrite, but I would not know why these should be required on a Get method.
I have found that MailboxSettings.Read did not work for me. I needed to consent to MailboxSettings.ReadWrite before I could actually read the settings. Could you try that and confirm if that works for you?
I have a project based on the Chris Hammond, Christoc, module template. I have a ton of code that I use to access data an external database. In my repositories I change the database from the default to whichever I need for that particular object. I do so with code that looks like this:
using (IDataContext ctx = DataContext.Instance(MyModuleSettingsBase.DATABASE_CONNECTION_STRING_KEY))
{
var rep = ctx.GetRepository<Product>();
products = rep.Get().ToList();
}
The default database is switched in the call to .Instance(). The repositories are used by my custom DNN modules. The repository is part of the solution that contains multiple custom modules. When I compile and install using the Extensions part of DNN, everything works well. In the code above, MyModuleSettingsBase.DATABASE_CONNECTION_STRING_KEY is found in a file MyModuleSettingsBase.cs file of my module solution. It is set to a simple string like "ProductDatabase". In the solution for the base DNN install (not the module solution), within the web.config file, there is a value in <connectionStrings> with name="ProductDatabase" which contains the actual connection string. This all links up fine on the DNN website.
Now I am writing a console application that does some monitoring of the site. I want to access the database to check values in the product table. I would like to reuse all of the repository code I have written. In an attempt to do so, I added a reference to the MyModules.dll file so I would only have one copy of the base code. This works to give me access to all the objects and the associated repositories but when I attempt to query data it fails. When debugging I can see that it fails on the line:
using (IDataContext ctx = DataContext.Instance(MyModuleSettingsBase.DATABASE_CONNECTION_STRING_KEY))
When viewed in a debugger, the string value MyModuleSettingsBase.DATABASE_CONNECTION_STRING_KEY is correctly set to "ProductDatabase" but the code is unable to link this with the actual connection string. I don't know where it would be checking for the connections string when running from my console application. I attempted to put a <connectionStrings> section into my App.config file but this didn't do the trick.
Is it possible to have MyModuleSettingsBase.DATABASE_CONNECTION_STRING_KEY map to the connection string in an external application which references the DLL?
If so, where can I set the value of my connection string so it matches up to the key value stored in MyModuleSettingsBase.DATABASE_CONNECTION_STRING_KEY?
I was faced similar problem 3 months ago, at that time I want to use DNN core libraries in my console application but I was failed.
I placed my queries in DNN official forum website and I got a valid response from Wes Tatters (DNN MVP).
Here is the post link: Reference URL
As your requirement of monitoring, I suggest you to create DNN Schedule Application. You can schedule it within DNN (Host->AdvancedSettings->Schedule), even good point is that you can use your repositories (DNN Libraries) in that schedule application.
I hope it solved your problem. Let me know if you have any questions.
I am trying to connect to Magento API using C#. I am using Magento Go service and from what I've read I am able to use their API - I hope I am not wrong here. So here is what I did:
I added a Service Reference to http://mydomain.gostorego.com/api/v2_soap?wsdl=1, and just adding a service worked fine. Now I created a test class with GetStuff() method, which looks like this:
using ww.Feeds.MagnetoGoService;
public static string GetStuff()
{
MagnetoGoService.Mage_Api_Model_Server_V2_HandlerPortTypeClient s = new MagnetoGoService.Mage_Api_Model_Server_V2_HandlerPortTypeClient();
var login = s.login("username here", "key here");
return login.ToString();
}
When I run the program I get an error in first line saying:
Could not find default endpoint element that references contract 'MagnetoGoService.Mage_Api_Model_Server_V2_HandlerPortType' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
Any ideas what this may be? Do I have to set something up in my Magento Go settings? Or maybe using Magento Go is not allowing API access?
Thanks a lot.
Forget SOAP with c# you will pull your hair out. Download Charls Cook's xml-rpc api libary for c# and use the xml-rpc method. You won't get all the snazzy intellisense but at least it will work. There's also c# solution from ez.newsletter they released with Cook's library demonstrating how to use 80% of the magento api calls.
Cook's library xml-rpc.net
http://www.xml-rpc.net/
ez.newsletter solution
http://code.google.com/p/csharlibformagexmlrpcapi/
If anyone ever has problems with this, my solution was this:
I used the reference in one project, but I actually called the class and had main program in another project. You need your Service reference to be in each project wherever you're using it. That fixed it! Alternatively you can create a new BasicHttpBinding() and putt all the options from app.config/web.config into that binder, then you don't need to reference to Service everywhere. I hope that helps!