Create CrmServiceClient object in plugin - plugins

In Dynamics CRM 2016 on-premise IFD, in a plugin, I try to create an object of type Microsoft.Xrm.Tooling.Connector.CrmServiceClient:
CrmServiceClient crmSvc = new CrmServiceClient(connString);
For connection string I have the following:
connString = "Url=https://{orgname}.{domain}.com/{orgname}; Domain={domain}; UserName={user}/{domain}; Password={password} AuthType=IFD";
but when the plugin fires I get the error:
Unable to Login to Dynamics CRM OrganizationServiceProxy is null
The format of connString is customized according to : Connecting to CRM 2016 IFD in PowerShell
and the information in connString is correct.
Thank you
Radu

Do you actually need to create a new CrmServiceClient using a connection string? You should have everything you need already using the LocalPluginContext passed in the Execute method of your plugin.
See this page for an explanation of the context passed to the plugin. You are probably after the Organization Service. Using the IOrganizationService, you can create your XRM Context if you need to.
If you show some code, maybe we can help you get connected.

Related

InternalServiceFault when trying to connect SPGo to SP Online in VS Code

I'm trying to connect the SPGo plugin in Visual Studio Code to a Sharepoint Online site. There are lots of guides for this, for instance this one: https://medium.com/niftit-sharepoint-blog/saying-goodbye-to-sharepoint-designer-ac939a0b79ba
In short, I'm doing it like this:
Open VS Code
Open a local, empty folder)
SPGO: Configure workspace (follow guide, ending up with spgo.json
looking like the one I pasted)
SPGO: Populate local workspace (asking me for credentials and I plot
it in O365 style (email and password).
Statusbar says "Populating workspace"
After about 10 seconds I get the pasted error in the output window (spgo)
I'm using newest versions:
Visual Studio Code 1.37.1
SPGo 1.4.3
I have tried various sites in my tenant and I know they are up. I am Site Collection Administrator for the sites. I know the credentials are correct, of course. the remoteFolders and publishingScope doesn't affect anything, when changed. I assume authenticationType should be "Digest".
SPGo.json:
{
"sourceDirectory": "src",
"sharePointSiteUrl": "https://domain.sharepoint.com/sites/SiteName",
"publishingScope": "Major",
"authenticationType": "Digest",
"remoteFolders": [
"/SitePages/"
]
}
I don't get any files in the local folder, instead I get an error in the output:
================================ ERROR ================================
<s:Fault>
<s:Code>
<s:Value>s:Receiver</s:Value>
<s:Subcode>
<s:Value xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</s:Value>
</s:Subcode>
</s:Code>
<s:Reason>
<s:Text xml:lang="en-US">The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.</s:Text>
</s:Reason>
</s:Fault>
Error Detail:
----------------------
{}
===============================================================================
Sorry I missed this post for so long. First- thanks for the detailed write-up. This is the first time I've seen this specific issue with SPGo, so I do not know for sure what is the root cause.
Couple questions:
Are you using ADFS Authentication with your Office 365/SharePoint Online instance?
Are you able to use Addin-Only Authentication on this SP Site?
SPGo should be able to automatically work with ADFS in SharePoint Online but, as a fall-back, you could use Addin-Only Authentication. In this scenario you would create a ClientId and ClientSecret pair for the SharePoint Site Collection you are accessing and authenticate using those credentials. The ClientId would act as your UserName, and the ClientSecret would be your password.
Under the covers, I am using the node-sp-auth package for user authentication. Sergei (s-KaiNet on Github) has a great write-up on how to enable Addin-Only Authentication in SharePoint Online on his site, which you can find here.
Thanks for using SPGo!

How to get version using EWS powershell

$Service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013_SP1);
In the above line Exchange2013_SP1 is hardcoded. Using powershell how can I dynamically get the version when running the script?
In the Code provided, you are trying to create an instance of WebServices.Data.ExchangeService(something similar to this), specifying exchange version via ExchangeVersion Enum.
However - the query after that is about knowing how to obtain Exchange Version via PowerShell. Probably this is very well documented and googling shows many hits about checking Exchange Version:
https://blogs.msdn.microsoft.com/deva/2012/04/27/powershell-determine-version-number-build-number-and-service-pack-of-exchange-server/
https://blog.jasonsherry.net/2012/12/27/get-exchangever/
If you make a request like Binding to the Inbox of a Mailbox in the response the build details of the CAS Server the processed the response is returned https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.exchangeservicebase.serverinfo(v=exchg.80).aspx and exposed via the ExchangeService Class this can be used to tell the CU that's been applied to the Target and is the most useful thing if you trying to track errors etc.
EWS Schema version (which is what you have hardcoded) and Server versions are two different things so I would suggest you read https://msdn.microsoft.com/en-us/library/office/dn741586(v=exchg.150).aspx . Autodiscover can be used to find the highest EWS Schema version of CAS server.

VSTS work item creation throttling issue with vsts-node-api

I’m developing a VSTS extension with a build task which should create up to 20,000 work items in a single build. Work items are created using WorkItemTrackingApi/createWorkItem function of vsts-node-api package. In current implementation, extension sends a request to create each work item, VSTS starts to throttle after creating about 100 work items.
Following are the errors logged in the build console.
• (2017-01-08T12:35:13.1385597Z Error: connect ETIMEDOUT 11.11.111:111:111)
• 2017-01-08T12:36:45.0090704Z Error: Failed Request: Internal Server Error(500) - TF246020: Microsoft SQL Server encountered an error while processing the results from one of the Team Foundation Server databases. The error may be caused by insufficient resources on the server. Wait a few minutes and try the operation again. If the problem persists, contact a SQL Server administrator.
2017-01-08T12:36:45.0090704Z ThrottlingMode = Unknown, MildResourceType = None, SignificantResourceType = None
Is there a way to create a bulk of work item with vsts-node-api?
Please advise how to resolve this.
There are the VSTS REST APIs for creating batches of work items, but the vsts-node-api does not wrap them up yet as of January 2017.
You may want to leverage directly the work item batch REST APIs of VSTS with your preferred JavaScript based library.
Please refer Create Large Amount of Work Items in TFS Using Javascript REST API
You can use below for authentication,
httpntlm.patch(options, function(err,res) {
console.log("patch complete");
console.log(res.body);
})

Agile Classes.jar file

I am using Agile PLM Version: 9.3.0.2 (Build 20). I am on the client side. I'm trying to use Eclipse to interact with Agile's API features. According to the Agile SDK Developer Guide I need both:
AgileAPI.jar
agileclasses.jar
I have the AgileAPI.jar file, but I don't have the agileclasses.jar file.
Any suggestions/links/ methods in which I can obtain this file!
AgileAPI.jar, contains the factories and interfaces used by the Agile EJB on server side.
If you have an Agile instance on a server, you don't need to have agileclasses.jar (unofficial API) but creating an IAgileSession using AgileSessionFactory, all the implementation of interfaces (IChange, IPrograms, IItem. etc) are retrieved using it.
session.getObject(IChange.OBJECT_TYPE, "ChangeNumber123");
where did you find that agileclasses.jar is required?
However, you can find them in the Weblogic Server shared lib folder.
EDIT
Eclipse interacts with an Agile Server using AgileAPI.jar.
String server = "http://myServer:7001/Agile";
HashMap<Integer,String> params = new HashMap<Integer, String>();
AgileSessionFactory instance = AgileSessionFactory.getInstance(server);
params.put(AgileSessionFactory.USERNAME, "myUsername");
params.put(AgileSessionFactory.PASSWORD, "myPassword");
IAgileSession session=instance.createSession(params);
IItem item = (IItem) session.getObject(IItem.OBJECT_TYPE, "ITEMID1234");
item.setValue("Page Two.MYFIELD", "Value");
The example above, connect to an instance of Agile (server) already started up and get the item with number ITEMID1234. Then it sets the value of a field (MYFIELD) with "Value"

Using SQL Server CE 4.0 with Entity Framework on Windows Azure

I am using SQL Server CE 4.0 with WebApi on Windows Azure Websites. I have been successfully able to deploy SQL Server CE. The weird problem I am facing is that my site is able to log me in using the same DB but I am not able to use any of the controllers to fetch the data.
I am using same connection string for both. The only difference is that for logging in I am using WebSecurity as I have enabled OAuth on the site.
Can someone throw some light on how to debug and fix this issue? The error I am getting for the calls is
Format of the initialization string does not conform to specification
starting at index 0.
However the same string works for authentication, change password, adding OAuth connections etc.
Thanks in advance
I connected to the site using FTP. I was not giving the site name as domain name and it was denying me access earlier. On connecting, I got hold of the Web.config file and I found something interesting. While publishing the site, the web.config was modified to add another connectionstring with the name of context_DatabasePublish.
This string had following details connectionString="ContextName_DatabasePublish.ConnetionString" providerName="System.Data.SqlClient"
Also there was a new section called context added to the entityframework section of the config file with all the details for the context to use but again pointing to same connection string. The provider it is using is sql and not sqlce. I believe that is the reason it was failing.
I uploaded my normal config file and the site started working. I need to explore more on to why and how the new connection string got added. I will post the details in comments.