Some new fields were create in Dynamics CRM.
Now need to push some data to those new fields from asp.net website.
Need to add those new fields to:
[assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute()]
namespace Xrm
how should this be done? I read that these is a tool that generates this class file (CrmSvcUtil.exe).
But I do not understand how this would work.
Is this something that need to be done through Dynamics CRM admin?
Please advise.
Thanks
This should be done by user which has System Administrator or System Customizer, because this user has to have access to all entities metadata.
Basically you should start with downloading CRM SDK, for your version of CRM. For example the latest SDK can be found here:
https://www.microsoft.com/en-us/download/details.aspx?id=50032
Install the SDK and go to the bin folder inside the folder where you installed it. There you can find crmsvcutil.exe. This tool is something like svcutil.exe - it simply generates proxy classes using CRM metadata service. So instead of referring to Account entity like that:
var account = new Entity("account")
you can simply do:
var account = new Account();
and you will have all the properties that account in your system has.
In order to generate this classes just run crmsvcutil.exe using windows command line with proper credentials (it's very well documented if you run it without any parameters). example usage would be:
crmsvcutil /url:https://orgname.api.crm4.dynamics.com/XRMServices/2011/Organization.svc /u:user#orgname.onmicrosoft.com /p:password /serviceContextName:XrmServiceContext /out:Proxies.cs /n:Xrm
this would generate file Proxies.cs, containing namespace Xrm (the one you have posted in your question) with all the entities and fields. Of course the parameters may vary based on what type of organization you are connecting to. If you have problems with specifying proper values then simply put /il as last command line parameter - it will open an interactive login form, that would make it simpler for you to pass proper connection data.
Related
I'm building a business app where read and write access permissions are important.
The project is a Provider hosted MVC 5 / SharePoint app built in Visual Studio 2012.
Johnny needs to be able to Read and Write content on SharePoint App A AND SharePoint App B
Dave needs to only be able to Read content on SharePoint App A
I've looked over a lot of documentation including this tutorial:
http://www.itunity.com/article/sharepoint-permissions-manage-access-sql-data-709
The problem is if I give Dave Read access at the site level he is allowed to access SharePoint App A but also SharePoint App B.
How do I effectively use SharePoint permissions to stop this unintended behaviour?
Should I even be using SharePoint permissions?
2nd example:
I am building an app for project management, there will be an Engineer who is able to create, read and edit projects, there is also an Accountant who views the projects billables.
If I give Read permissions to Engineer and Read permissions to Accountant, how do I know which can view the project details and which can view the project's billables?
I read the article you linked to, and I am not sure that this is "authorization", the right word is "authentication", in sharepoint you set what a user can do, authorization means- which data user can read or write
so a simple solution for you is creating Group in sharepoint, for any authorization type you have, for example, a group called "Engineer", and gives it the permissions you need, your engineers will be members in this group.
in your MVC attribute, accept the group as parameter and check if user is member in this group, show the user the relevant data according to its group
public SharePointPermissionsAuthorizationAttribute( params string group) { _groups = groups; }
[SharePointEffectivePermissionsFilter("Engineer"]
public ActionResult Index() { ... } }
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.
Working with inherited code that reads data from one database (Visual Fox Pro) and stores it in SQL server. These are separate systems and use a WebService to send XML containing data from VFP.
A field has been added to both databases, and data has been seeded in the VFP database, but we are having problems with the WebService that is meant to sync the data. The WebService seems to be correctly generating and sending XML (with the new field and data) however it appears that the models that are meant to handle it on the .NET application are not being generated correctly and do nothing with this new field.
While viewing the object browser there is an 'OnlineAudienceWebServiceRef' within that, there is an OnlineAudienceDAL.OnlineAudienceFoxProRow which appears to contain a description of columns of the model. We are trying to add a new column to this Object (to receive the new data) but it appears auto-generated.
My question is, fundamentally, what is happening when Visual Studio is linked to a WebService? What files are generated, and how are they generated?
Given the web service correctly sends the new data, I was expecting Refs to be updated upon clicking 'Update Web Reference' from the solution explorer, but apparently that is not the case, and I would like know know what is going on.
There is an 'OnlineAudienceDAL.xsd' where we have added the new column, but we do not see that impacting the Object that is used to read the data.
According to App.config the app is using .NET v4, we are using Visual Studio 2010.
I am not familiar with .NET and the many things that are going on here, and would like to be pointed in a good direction. Sorry if this is confusing, please let me know what information I might be omitting and if anything is unclear.
Thank you for any help.
This is an example the Command Line Utility used by visual studio to generate the web service manually IF you have the WSDL (or XSD) file in a local folder. (WSDL is the Web Service Definition File)
This is in a batch file in my case... and also generates a VB file, but is easy to switch to C# I'm assuming with the last command line argument.
cd C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin
wsdl.exe "c:\development\WebServiceClients\CORE_Webservice_Interface_WS.wsdl" /fields /n:Telus /out:"c:\Development\output\WebServiceClients\referencefile.vb" /l:VB
WSDL.EXE is the core of this... below are the options...
c:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0\Bin>wsdl /?
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation. All rights reserved.
wsdl.exe -
Utility to generate code for xml web service clients and xml web services
using ASP.NET from WSDL contract files, XSD schemas and .discomap
discovery documents. This tool can be used in conjunction with disco.exe.
wsdl.exe ...
OPTIONS -
-
A url or path to a WSDL contract, an XSD schema or .discomap document.
/nologo
Suppresses the banner.
/language:
The language to use for the generated proxy class. Choose from 'CS',
'VB', 'JS', 'VJS', 'CPP' or provide a fully-qualified name for a class
implementing System.CodeDom.Compiler.CodeDomProvider. The default
language is 'CS' (CSharp). Short form is '/l:'.
/sharetypes
Turns on type sharing feature. This feature creates one code file with
a single type definition for identical types shared between different
services (namespace, name and wire signature must be identical).
Reference the services with http:// URLs as command-line parameters
or create a discomap document for local files.
/verbose
Displays extra information when the /sharetypes switch is specified.
Short form is '/v'.
/fields
Generate fields instead of properties. Short form is '/f'.
/order
Generate explicit order identifiers on particle members.
/enableDataBinding
Implement INotifyPropertyChanged interface on all generated types
to enable data binding. Short form is '/edb'.
/namespace:
The namespace for the generated proxy or template. The default namespace
is the global namespace. Short form is '/n:'.
/out:
The filename or directory path for the generated proxy code. The default
filename is derived from the service name. Short form is '/o:'.
/protocol:
Override the default protocol to implement. Choose from 'SOAP',
'SOAP12', 'HttpGet', 'HttpPost'.
/username:
/password:
/domain:
The credentials to use when connecting to a server that
requires authentication. Short forms are '/u:', '/p:' and '/d:'.
/proxy:
The url of the proxy server to use for http requests.
The default is to use the system proxy setting.
/proxyusername:
/proxypassword:
/proxydomain:
The credentials to use when the connecting to a proxy server that
requires authentication. Short forms are '/pu:', '/pp:' and '/pd:'.
/appsettingurlkey:
The configuration key to use in the code generation to read the default
value for the Url property. The default is to not read from the config
file. Short form is '/urlkey:'.
/appsettingbaseurl:
The base url to use when calculating the url fragment. The
appsettingurlkey option must also be specified. The url fragment is
the result of calculating the relative url from the appsettingbaseurl
to the url in the WSDL document. Short form is '/baseurl:'.
/parsableerrors
Print errors in a format similar to those reported by compilers.
ADVANCED -
/server
Server switch has been deprecated. Please use /serverInterface instead.
Generate an abstract class for an xml web service implementation using
ASP.NET based on the contracts. The default is to generate client proxy
classes.
/serverInterface
Generates interfaces for server-side implementation of an ASP.Net
Web Service. An interface is generated for each binding in the wsdl
document(s). The wsdl alone implements the wsdl contract (classes
that implement the interface should not include either of the following
on the class methods: Web Service attributes or Serialization
attributes that change the wsdl contract). Short form is '/si'.
/parameters:
Read command-line options from the specified xml file. This allows you
to specify options not available from command line such as choosing
which type of asynchronous programming model is generated. For details,
please see the tool documentation. Short form is '/par:'.
I am writing a custom piece of code that dynamically creates modified document libraries. I've attempted to create a document library template, which succeeds in the UI but cannot be found via-webservices.
So to get to the point - I am attempting to:
1. Set "Allow Management Of Content Types" on the list.
2. Add a new Content Type (Already Created) to the list.
3. Set the new content type as the default content type.
4. Remove the "Document" content type from the list.
So far I have succeeded in being able to "Apply" the custom content type but the others are evading my grasp. The methods I have attempted are through the Lists.asmx service and the method described here: http://msdn.microsoft.com/en-us/library/websvclists.lists.updatelist.aspx
I tried setting the Flags property and a few other potential candidates with no success and no error messages complaining about what I was trying to attempt.
One limitation is that I do NOT have access to the sharepoint dll where this is living.
Once completed - this would be a plugin living in another non-sharepoint system. The only option to include the SharePoint client dll's would be to perform an ILMerge.
EDIT:
http://msdn.microsoft.com/en-us/library/sharepoint/jj193051.aspx (SharePoint 2013 Web Services)
http://msdn.microsoft.com/en-us/library/ee705814(v=office.16).aspx (SharePoint 2010 Web Services)
and yes - technically the ASMX services sound like they're on their way out: http://msdn.microsoft.com/en-us/library/sharepoint/jj164060.aspx
Edit: Tags are relevant to the question.
use SharePoint Client Object Model. This is a library that wraps calls to webservices that allows among other things to batch commands.
The operations you mention are all available.
here is a link to an article that explains Client Object Model:
http://www.codeproject.com/Articles/399156/SharePoint-2010-Client-Object-Model-Introduction
The article focus on ListItems but you can also interact with list properties, even web properties if you want.
Please note that you don't need to run Client Object Model from your sharepoint server. Note the "Client" part in the name.
My app adds some custom metadata to files. I want to display it in Windows Explorer like this:
or this:
Is there a way to do this in .NET?
There are two approaches to building custom columns in Windows File Manager: using Windows Property System and Property Definitions for Cloud Storage Provider. You will typically use the first approach to create custom properties for file types that you own. You will use the second approach when displaying custom data from your document management system or any other storage.
Using a Windows Property System.
You can create custom properties for specific file types in Windows Vista and later versions. These properties can be read-only or read-write. As well as they can be indexed by Window Search indexer and participate in the search. There are some limitations:
Microsoft clearly says that property handlers must be in C++, it can not be in .NET:
...property handlers cannot be implemented in managed code and should be
implemented in C++.
The property is tied to the specific file type, which typically belongs to your application. You can not create a property for all file types.
Using Cloud Storage Provider Property Definitions
In Windows 10 Creators Update and later you can add custom columns for file systems created using Cloud Sync Engine API (Storage Provider, Cloud Filter API). This API is used in such tools as OneDrive. You will need to register a Cloud Storage Provider sync root with custom properties definitions, provide data for your custom columns and finally implement a Cloud Storage provider using Cloud File/Cloud Filter API.
Property definitions are not tied to a file type and can be added for all files. Also, even though only some API is available in .NET you still can call Win32 functions and build a cloud provider using managed code only.
Registering the Cloud Storage provider. Here is an example of the Storage Provider registration with custom columns in C#:
StorageProviderSyncRootInfo storageInfo = new StorageProviderSyncRootInfo();
storageInfo.Path = await StorageFolder.GetFolderFromPathAsync("C:\\Users\\User1\\VFS\\");
...
// Adds columns to Windows File Manager.
// Show/hide columns in the "More..." context menu on the columns header.
var proDefinitions = storageInfo.StorageProviderItemPropertyDefinitions;
proDefinitions.Add(new StorageProviderItemPropertyDefinition { DisplayNameResource = "Lock Expires", Id = 2, });
proDefinitions.Add(new StorageProviderItemPropertyDefinition { DisplayNameResource = "Lock Scope", Id = 3, });
StorageProviderSyncRootManager.Register(storageInfo);
A complete registration example could be found here.
Providing data for property definitions. To provide the data for the columns you will use StorageProviderItemProperties.SetAsync() call:
IStorageItem storageItem = await Windows.Storage.StorageFile.GetFileFromPathAsync(path);
StorageProviderItemProperty propState = new StorageProviderItemProperty()
{
Id = 3,
Value = "Exclusive",
IconResource = "C:\\path\\icon.ico" // The optional icon to be displayed in the Status column.
};
await StorageProviderItemProperties.SetAsync(storageItem, new StorageProviderItemProperty[] { propState });
Another approach would be implementing IStorageProviderItemPropertySource interface. It returns properties based on your file path.
Cloud Storage Provider implementation. Finally, you will need a complete file system implementation, supplying data for your files/folders placeholders. You can find complete examples in .NET/C# here:
This post is marked obsolete because the content is out of date. It is not currently accepting new interactions.
PLEASE PAY ATTENTION: THIS ANSWER IS FOR XP AND VISTA ONLY, IT IS OUTDATED
It can be done on XP using a Column Handler shell extension - see here:
http://www.codeproject.com/Articles/3747/Explorer-column-handler-shell-extension-in-C#
However IColumnHandler is not supported on Vista and up. Here you have to implement PropertyHandler. See Windows SDK \Samples\winui\Shell\AppShellIntegration\PropertyHandlers.
Each property is described by property schema XML file. This property schema must be registered with PSRegisterPropertySchema(). Property handler implements IInitializeWithXXX, IPropertyStore and optionally IPropertyStoreCapabilities. You have to register CLSID of your implementation for each file extension you want to handle.
Unfortunately, you cannot use AllFileSystemObject or * in registration.