"Always start with where the error is, then what the error is" I am MVP, founder and CTO at CRM-Konsulterna AB a company specializing in only Microsoft Dynamics CRM.
Thursday, March 15, 2007
Bugg found in SharePoint 3
Well, not a big problem, we thought, we'll just change it back. Well... we couldn't... so we were stuck with a "non-Title-name". Bad, really bad. The only way I found of resetting this, was to delete the entire sitecollection (I had changed the site column at the top site) and the creating a new one. Not a very nice workaround...
So, be ware, don't change the "Title" site column located in the group "_hidden".
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
Wednesday, March 14, 2007
Content Query Web Part
http://msdn2.microsoft.com/en-us/library/ms497457.aspx
Here is another blog posting concerning the same theme:
http://www.microsoft.com/belux/msdn/nl/community/columns/stevenvandecraen/contentquerywebpart.mspx
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
Monday, March 12, 2007
Different versions of MOSS
http://office.microsoft.com/search/redir.aspx?AssetID=XT102011901033&CTT=5&Origin=HA101978031033
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
Thursday, March 08, 2007
New CRM 3.0 Partner Preparedness Tools Available
"CRM 3.0 Partner Preparedness Tools".
Please check it out at the following site:
Jim glass blog
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
Wednesday, February 28, 2007
Callouts in Service Provider Edition of Microsoft CRM 3
Finally!
I got it to work, and it actually wasn't too difficult when I got hold of the correct DLL:s. So, first hot tip, right out the furnace:
"When developing for CRM Service Provider Edition, make sure you got CRM Service Provider Edition versions of your dll:s".
This can actually be a bit problematic when working in a development environment on a VPC since it is quite rare to have the entire Hosted Environment, like Hosted AD, Hosted Exchange etc on your virtal machines. If you do, great, use it, but I would guess that most of you don't.
I will give you a short walkthrough of how to create a post callout using the CRM Service Provider Edition. I will focus mainly on the differences between developing a normal callout and one for for CRM SPE.
First off, copy the file Microsoft.Crm.Platform.Callout.Base.dll from the CRM SPE CD 1 (\bin\Assembly). Put it somewhere where it is possible to add a reference to it. Like c:\temp.
Now, add a reference to it in the project.
Modify the callout.config.xml file just like you usually do, for instance:
<callout.config version="3.0" xmlns=" http://schemas.microsoft.com/crm/2006/callout/">
<callout entity="account" event="PostUpdate">
<subscription assembly="CalloutLibrary.dll" class="CalloutLibrary.AcctCallouts" />
</callout>
</callout.config>
Create a class file called AcctCallouts in the namespace CalloutLibrary and make sure the dll is called "CalloutLibrary.dll". (If you name your project CalloutLibrary, this will be default).
using System;using Microsoft.Crm.Callout;
using System;using System.Data;
using System.Net;
using System.Web;
using MSAB.CalloutLibrary.CRMSDK;
using Microsoft.Crm.Callout;
using System.Globalization;
using System.IO;
namespace CalloutLibrary
{
public class mbaktivitet: CrmCalloutBase
{
private CrmService service;
private WhoAmIRequest userRequest;
private WhoAmIResponse user;
public override void PostCreate(
CalloutUserContext userContext,
CalloutEntityContext entityContext,
string postImageEntityXml)
{
string usr = "username@test.local";
string pwd = "1m0rePassword";
string HostedCRMurl ="http://crmserver.hostingcompany.com";
service = new CrmService();
service.Url = HostedCRMurl + "/mscrmservices/2006/crmservice.asmx";
service.CookieContainer = new CookieContainer();
service.CookieContainer.Add(GetCRMCookie(HostedCRMurl, usr, pwd));
//Make sure the webservice works
userRequest = new WhoAmIRequest();
user = (WhoAmIResponse) service.Execute(userRequest);
}
}
}
The important call here is the GetCRMCookie(HostedCRMurl, usr, pwd), a method that I will describe bellow which returns an authentication cookie that can be used to authenticate against the web service. Here is its definition, it is more or less what Arash has written on his blog concerning how to write web services for CRM SPE.
public Cookie GetCRMCookie(string url, string userName, string password)
{
DebugText("Start of GetCRMCookie");
Cookie authCookie;
try
{
Uri serverUri = new Uri(url);
Uri logonServerUri = new Uri(serverUri, @"LogonServer/Logon.aspx");
string encodedUserName = HttpUtility.UrlEncode(userName);
string encodedPassword = HttpUtility.UrlEncode(password);
string logonServerUrl = String.Format(CultureInfo.InvariantCulture, "{0}?UserName={1}&Password={2}", logonServerUri.ToString(), encodedUserName, encodedPassword);
// Make a web request that does not allow redirection
HttpWebRequest logonRequest = (HttpWebRequest)WebRequest.Create(logonServerUrl);
logonRequest.AllowAutoRedirect = false;
logonRequest.CookieContainer = new CookieContainer();
HttpWebResponse logonResponse = (HttpWebResponse)logonRequest.GetResponse();
authCookie = null;
using (logonResponse)
{
if (HttpStatusCode.Found != logonResponse.StatusCode)
{
// throw new CrmException(logonServerUrl, ErrorCodes.InvalidOperation);
}
if (null == (authCookie = logonResponse.Cookies["CRMAuthCookie"]))
{
// throw new CrmException(logonServerUrl, ErrorCodes.InvalidOperation);
}
}
// Now we have the cookie, make sure the credential is valid by passing the cookie back to CRM
logonRequest = (HttpWebRequest)WebRequest.Create(serverUri);
// The following user agent is required by CRM
logonRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2)";
logonRequest.AllowAutoRedirect = false;
logonRequest.CookieContainer = new CookieContainer();
logonRequest.CookieContainer.Add(authCookie);
logonResponse = (HttpWebResponse)logonRequest.GetResponse();
using (logonResponse)
{
if (HttpStatusCode.OK != logonResponse.StatusCode)
{
throw new InvalidOperationException(logonServerUrl);
}
}
return (authCookie);
}
catch (Exception err)
{
return null;
}
}
That’s about it. Using this technique, you should be able to get your SPE Callouts to work.
Make sure that the callout.base is exists in the servers GAC, if not, copy it there.
Note that post-callouts, won’t break the execution if there is an error but they will leave the error exception sprecification in the eventlog so make sure you have a look at it.
So, in short, there are two main differences when developing callouts that use web services when comparing normal CRM with SPE CRM, they are:
- DLL:s are unique. The version number for SPE is 3.0.5745.0 while the version for the normal CRM is: 3.0.5300.0.
- To authenticate, you cannot use the normal System.Net.CredentialCache.DefaultCredentials but, you have to use the “slightly” more complicated method of capturing the authentication cookie and using it to log in.
As you might have noticed in the code, the user is hard-coded, which means that there will not be any impersonation in the way it works in normal CRM. I have an idea of how this might be solved; by creating a new aspx-page to capture the username and password, creating a cookie using these credentials and then storing it in the session variable to enable further loggin in later with the webservice. One would also have to make sure that the cookie can be used by the normal IE klient as well. As you might understand, there are some question marks here that I will try to straighten out. If I find a solution to impersonation in CRM SPE, I will be sure to create a post about it!
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
Tuesday, February 27, 2007
Service Provider Edition / Hosted CRM
I am developing callouts and will write some more about what the differences are, for now I will leave you with a reference to a blog that actually mentiones something about this.
For one, there is a different version of Microsoft.Crm.Platform.Callout.Base.dll and there is a different way of authenticating when using the webservice. I will write I bit more about it later.
Have a look at this blog for now: Microsoft.Crm.Platform.Callout.Base.dll
http://crm.davidyack.com/journal/2006/7/21/callouts-and-the-service-provider-edition.html
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
Import of customizations not working in IE 7
http://blog.sonomapartners.com/2007/01/importing_custo.html
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
Wednesday, February 21, 2007
How to create many-to-many relationships in CRM
http://blogs.msdn.com/crm/archive/2007/02/15/many-to-many-relationships-in-ms-dynamics-crm-3-0.aspx
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
CRM Analytics foundation
http://www.codeplex.com/crmanalytics
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
Monday, February 19, 2007
MOSS and CRM Webparts
Please click this posts heading to go to the posting I found.
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
IFrame security problems
I had some problems with the dymanic functionalities of the report, which didn't work. After some work, I found that it was due to the fact that the Reporting Server had the wrong security settings in IE, and hence was prohibited to fully use the JavaScripts that controlled the drill-down of the reports. The simple solution was to add the reporting server to Local Intranet Sites in IE.
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
Monday, February 05, 2007
How to create .NET-class files from xsd files
To some of you, this might be yesterday’s news, but for those of you who havn't tried it, you should.
I will try to explain how to do it here. In this example, we'll be basing the .NET class on a InfoPath form. InfoPath is, as you might know, just a front-end to XML, ie. a user friendly way of creating xml-data.
Create you xml-form in any way you like. I won't go into how exactly you do that, but
That will create a schema in the background. To export it to an xsd-file, select “Save as source files…” from the file menu and direct it to a directory of your choice, for instance, “c:\temp”.
Use the file explorer, go to the directory where you just saved the files, and you will find a file with the name of your different data sources followed by the extension “.xsd” in this directory. Remember the name of the xsd-file, let’s call it “source.xsd” in this example.
Then, start up a “Visual Studio 2005 Command Prompt”, go to the directory where you saved the source files, for instance:
cd c:\temp
Then, using the command xsd you can create the cs-file containing the .NET-class with the following command:
xsd source.xsd /c
This will create a new file called “source.cs”. This is the file that contains the .NET class.
Now open your development project and add the file source.cs to the project. This will now give you access to the .NET class in you project. Open the file and you can see the name of your class, it should be “myFields”.
Now we want to instantiate the class with some xml-data. This is done in the following manner using c#-code.
XmlSerializer serializer = new XmlSerializer(typeof(myFields));
XmlTextReader reader = new XmlTextReader(“c:\XmlInstanceOfSourceXsd.xml”);
myFields fields = (myFields)serializer.Deserialize(reader);
Now, you can access the xml-data using the instance fields of the class myFields.
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
Wednesday, January 31, 2007
News about Titan
In the article from MS (click the heading of this post) they mention that they are planning to release Titan in mid 2007. The last release for version 3, was actually ahead of schedule so, I believe we could actually expect it to arrive in Q3 2007.
Some of the new features that are rumored to be found in Titan are multi-language (in the same installation) and multi-currency. Features that will enable MS CRM to move into the league of the more international companies.
When I hear more, I will surely let you know!
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
Tuesday, January 30, 2007
How to create an CRM email with a report server attachment as a pdf
To make it a bit flexible, I created a function that could be called from the workflow engine.
Here is the method declaration that I will use bellow:
public string SendMailWithReport(System.Guid OrderId, string subject, string body, string reportpath, string callerXml)
The parameters are as follows:
OrderId – A Guid containing the orderid to be used as a parameter to the report.
Subject – a string that will contain the mail subject.
Body – a string that will contain the mail body
Reportpath – to make it a bit more flexible, the report path is not hard coded but can be inputed as a parameter,
callerXml – standard handling for getting the caller data to enable impersonation.
The first thing we want to do is to get the pdf from the report server.
We’ll store the binary pdf in the byte-array called result. When this is done, we’ll encode this into a string called encoded data. The rest is stuff that is needed to make this happen.
string encodedData = "";
//Create Report PDF
ReportingService rs = new ReportingService();
rs.Credentials = new System.Net.NetworkCredential(username, passwd, domain);
Byte[] result;
string encoding;
string mimetype;
ParameterValue[] parametersUsed;
ParameterValue[] parameters = new ParameterValue[1];
parameters[0] = new ParameterValue();
parameters[0].Name = "CRM_OrderId";
parameters[0].Value = "{" + OrderId.ToString() + "}";
Warning[] warnings;
string[] streamids;
result = rs.Render(reportpath,
"PDF",
null,
null,
parameters,
null,
null,
out encoding,
out mimetype,
out parametersUsed,
out warnings,
out streamids);
encodedData = System.Convert.ToBase64String(result);
The most complex part of this which took me the most time, was the “Render” method of the reporting server web service. I use it this way because it works, don’t ask me what all the parameters really are, I don’t know.
The next part is to create the CRM mail. This is quite straight forward, if you are used to the crm web service.
The “from” and “to” can be set to anything that can be used as a “to” or “from” in the CRM GUI.
CrmService service = new CrmService();
service.CallerIdValue = new CallerId();
service.CallerIdValue.CallerGuid = GetCaller(callerXml);
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
//Get current user
WhoAmIRequest userRequest = new WhoAmIRequest();
WhoAmIResponse user
= (WhoAmIResponse) service.Execute(userRequest);
//Load salesorder and account objects.
salesorder so = (salesorder)service.Retrieve(EntityName.salesorder.ToString(), OrderId, new AllColumns());
account acc = (account)service.Retrieve(EntityName.account.ToString(), so.customerid.Value, new AllColumns());
email em = new email();
activityparty from = new activityparty();
from.partyid = new Lookup();
from.partyid.type = EntityName.systemuser.ToString();
from.partyid.Value = user.UserId;
em.from = new activityparty[] {from};
activityparty toparty = new activityparty();
toparty.partyid = new Lookup();
toparty.partyid.type = EntityName.account.ToString();
toparty.partyid.Value = acc.accountid.Value;
em.to = new activityparty[] {toparty};
em.subject = subject;
em.sender = "test@test.com";
em.regardingobjectid = new Lookup();
em.regardingobjectid.type = EntityName.salesorder.ToString();
em.regardingobjectid.Value = so.salesorderid.Value;
em.description = body;
em.ownerid = new Owner();
em.ownerid.type = EntityName.systemuser.ToString();
em.ownerid.Value = user.UserId;
Guid createdEmailGuid = service.Create(em);
Now, we have created the email. You can see it in CRM if you like.
The last part is now to create the attachment on the email as the pdf that we downloaded from the report server in the first part of this walk-through.
activitymimeattachment ama = new activitymimeattachment();
ama.activityid = new Lookup();
ama.activityid.type = EntityName.email.ToString();
ama.activityid.Value = createdEmailGuid;
ama.body = " ";
ama.mimetype = "application/pdf";
ama.attachmentnumber = new CrmNumber();
ama.attachmentnumber.Value = 1;
ama.filename = "A filename";
Guid createdAttachment = service.Create(ama);
//Upload file
// Create the Request Object
UploadFromBase64DataActivityMimeAttachmentRequest upload = new UploadFromBase64DataActivityMimeAttachmentRequest();
// Set the Request Object's Properties
upload.ActivityMimeAttachmentId = createdAttachment;
upload.FileName = "attachmentfilename.pdf";
upload.MimeType = "application/pdf";
upload.Base64Data = encodedData;
// Execute the Request
UploadFromBase64DataActivityMimeAttachmentResponse uploaded = (UploadFromBase64DataActivityMimeAttachmentResponse) service.Execute(upload);
The last part, if you want to, is to send the mail:
SendEmailRequest req = new SendEmailRequest();
req.EmailId = createdEmailGuid;
req.TrackingToken = "";
req.IssueSend = true;
SendEmailResponse res = (SendEmailResponse)service.Execute(req);
I have made some simplifications, like removing try-catch clauses, which you really should use, but the code has apart from that been cut-n-pasted from a working application and should work.
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
Thursday, January 25, 2007
A question from a CRM admin
---
Hi Gustaf,
Let me introduce myself, I am XXX new to MS CRM. I got your mail id through your blog.I am mailing you as we have a urgent query with respect to mscrm. We have a company domain, which is being used by the entire organisation, now if i am going to install MS CRM 3.0 Server setup do we need to have a different domain/domain controllers for the CRM. Are their any issues which must be taken care of before going ahead, as we will be dealing with the live domain. The objective of this is to integrate with sharepoint technologies. I will be thankful for your earlier response.
Regards, XXX
---- My answer:
Hi,
When you install MS CRM 3 it will add a few groups to the AD, but apart from that will not touch the AD. MS CRM:s user handling and security information is stored in the MS CRM database hence no need for further schema extensions of the AD.
I understand your concern when installing on a live domain but there should not be any problems. If you still feel a bit worried, you can always install MS CRM in a virtual environment and see the changes for you self.
The live CRM server should be installed in the company domain.
Kind regards,
Gustaf
------
If your question is in regard to something I've posted on the blog, please add it as a comment, otherwise, you can always mail me. Please note that I will gladly answer technical questions like the one above but it is not feasable for me to design you solution. If you want my help in that aspect, please contact Humandata (www.humandata.se) and we can get you a good deal. I hope you appreciate that even I need to have a house to live in and food for my family :)
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
Back again - with a question
I've tried to find out a bit more about the upcoming integration engine CRM-Nav from Microsoft but have not been very successful. The main question is what kind of infrastructure it will be based on and I think the following three are the hottest tips:
1. Celenia/Tectura - The integration formerly known as Tectura, (see my previous postings), now called the Celenia CRM-Nav integration, has previously been put forward by Microsoft as THE integration engine to use.
2. BizTalk based integration - BizTalk is the talk of the town concerning integration, and it would not be very strange if the integration would be BizTalk based.
3. New/Custom - They might just have sat down and started from scratch and written an integraiton engine specifically for CRM-Nav.
Well, where's my money? To start off, Microsoft have been very very quite about this integration engine, would seem a bit strange if the engine would be according to 2 or 3 above, when there really would be no reason for that.
However, if they are up to an aquisition of Celenia or just the program, then they would probably like to be just very very quite about it until all the formalities had been settled.
Another reason for not going along with 2, the BizTalk version, is that it would require an installation of BizTalk at each customer which might cause more problems and costs than what is reasonable.
One reason for not choosing 3 is that it most probably will be quite costly.
Something to take into consideration in the Celenia business is that the integration engine was previously owned by Tectura (although it had been developed by Celenia) but for reasons unknown to me, was reverted to Celenia. Most probably after considerable preasure from Microsoft.
Bottom line, my money is on the Celenia integration (1). Which versions of Nav it will support is still unknown and if it will still only be a technical integration is also still unknown, when I learn more, I will let you know.
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
Monday, December 18, 2006
IT-Proffs - CRM
If you havn't already been there, check out the swedish forum called IT-Proffs, it has (as far as I know) the only Swedish CRM forum. You will find me and several other talented and skilled CRM-professionals there like Jonas Deibe (Microsoft Sweden).
Apart from the global CRM-forum/newsgroup hosted by Microsoft, this is a bit smaller which makes it easier to handle, and doesn't flood you inbox.
Please note that you can set an automatic notification when a new messsage is added to the CRM-Forum. I hope to see you there soon! www.itproffs.se
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
Friday, December 15, 2006
SharePoint inside Outlook using Sitemap configuration in CRM.
I don’t know exactly why this happened but I think it happens due to the loading of some active-X components that are not supported by the web browser in Outlook, which for some reason doesn’t seem to be IE. If anyone knows anything more about this, please let me know.
Oh, I forgot, we were using Outlook 2003 since V3C isn’t publicly released yet. Perhaps you won’t get this error if using Outlook 2007 since it is probably more compatible with SharePoint v3.
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
Wednesday, December 13, 2006
Unable to access System Settings - weird error
Well, as most of you probably already have heard, there is a Update Rollup containing lots of the hot-fixes previously released and also a few more features – like being able to set which attributes should be searchable in advanced find. You can download it here.
When working on the POC mentioned above I stumbled on a strange error. CRM worked fine (not the reports though, I found out at a later stage), but when I tried to access System Settings I got a really weird error message containing html-code. What had happened was this.
The VPC I was using had WSS v2 installed on port 80. I installed CRM on port 5555 (reporting services had been installed into port 80 /Reports and /ReportServer). After this I installed Enterprise Project Management (EPM) (i.e. WSS v3 with EPM addon), set it to work on port 80, thinking it would overwrite the existing WSS v2 and let Report Services work as it should. Utopia, this is not what happened.
What really happened was that EPM/WSS had switched off WSS v2 on port 80 and created a new website for port 80 (no host header). In other words, also switching off Reporting Services. When I tried to access System Settings in CRM, it tries to access Reporting Services for some of the settings and since WSS v3 was installed, it handled the call and returned an html-page displaying that the resource wasn’t available. This was handled by CRM as an exception and the content of the html-page was displayed in the error (as html-code).
So, what should I have done?
Uninstall WSS v2, install EPM/WSS v3, reinstall SQL RS, install CRM. Then I probably wouldn’t have experienced the problem I had above.
Use hostheaders to separate the different websites as suggested from Microsoft Swedens CRM guru Jonas Deibe.
I hope you don’t have to experience the same problem, since the only solution I feel works, is to reinstall.
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se
Friday, December 01, 2006
Microsoft CRM and Excel 2007
One of the features of Microsoft CRM that many managers (and others) like is the Excel-button on lists. However, with Excel 2007, it doesn't work out of the box. For the demo, I got it to work by doing the following actions. Please note that these actions should only be used in a demo environment since they severely alter some of the security settings of Excel. When I find a better way to handle this (or if I find some one else that does), I will let you know.
1. Make sure you are running Excel as a user that has access to the CRM database. This is due to the fact that Excel will try to access the database directly and it wont work properly if you don't have access. The best way is to use a client computer that is part of the domain and a user that is a CRM user. That usually solves it.
2. Add "c:\users" to the trusted places in the trust center.
3. Set "Trust all incomming connections (not recommended)" in the trust center.
Now it should work. Sometimes it takes Excel a while to get the data from the server, so be a bit patient. When I wrote this, I didn't have access to a test environment with CRM and Excel 2007 so I might have some details wrong (like the exact naming of fields in trust center).
I hope it works for you, Microsoft CRM 3 with the new Excel 2007 with conditional formating will blow the socks off any Manager I know... :)
Gustaf Westerlund
CRM and SharePoint Consultant
Humandata AB
www.humandata.se