Olaf and I were cracking away on some SharePoint 2010 work which we thought should be simple…point SPMetal to the site and start LINQ-ing to our hearts content….. with the one exception that we couldn’t select items from a list based on their Content Type. By default SPMetal.exe doesn’t include these ‘system’ fields (apart from ID + Title – go figure) and the secret is to use an Override file. The good oil is:http://msdn.microsoft.com/en-us/library/ee535056.aspx (Here’s a good article on how .NET Types are mapped to SharePoint - http://msdn.microsoft.com/en-us/library/ee536245.aspx) The simple override/parameters file: <Web AccessModifier="Internal" xmlns="http://schemas.microsoft.com/SharePoint/2009/spmetal"> <ContentType Name="Item" Class="Item"> <Column Name="ContentType" Member="ContentType" /> </ContentType> </Web>
The SPMetal Command Line
The VS.NET Code
static void Main(string[] args) { using (BreezeDataContext dc = new BreezeDataContext("http://breezelocal")) { var myitems = from i in dc.GetList<ContentListTraining>("My Content List") where i.ContentType == "Training" select i; var courses = myitems.ToList<ContentListTraining>(); Console.WriteLine("There are {0} items",courses[0].Title); } Console.ReadLine(); }
Hey folks, As we’re all aware there’s more than one road that leads to Rome when dealing with integration. When to use SSIS? For what? What about MSMQ? AppFabric and BizTalk etc. At TechEd this year I’ve decided to run some preconference training dealing with this exact issue across many different Microsoft Integration Technologies. (This is one of the biggest questions I get from customers) If you’re heading to the Gold Coast this year, then this training is before TechEd – get up a couple of days early and then be fully charged and armed with all your questions…. ---- here’s the official blurb---- When to use what Technologies Where [LINK is Here] AppFabric, Azure Storage, BizTalk 2010, BizTalk Adapter Pack, WCF, WF, Oslo, MSMQ, .NET4 Distributed Caching, SQL Service Broker, SSIS and SharePoint 2010 Service Applications...to name a few technologies to be confused about. There is no silver bullet for application integration. Different situations call for different solutions, each targeting a particular kind of problem. While a one-size-fits-all solution would be nice, the inherent diversity of integration challenges makes such a simplistic approach impossible. To address this broad set of problems, Microsoft has created several different integration technologies, each targeting a particular group of scenarios. Together, these technologies provide a comprehensive, unified, and complete integration solution. Come on a 2-day adventure examining each of these technologies and reviewing the When, Why's and How's on each, with their own distinct role to play with integrating applications. When you come through the other side you'll be able to slot each of these technologies into a *practical* use. This developer workshop is based on real world examples, real world problems and real world solutions. Join me and be prepared to roll up your sleeves and unravel the maze that awaits.... TECHED LINK
I’m in the process of planning a SP2007 to SP2010 ‘migration’ moving over the content database and other web artifacts. I was making sure all things were ticked off and available in the new SP2010 environment such as – additional external scripts, paths, externally accessible images, webparts + flash movie files. Migrated over – fired up the browser and after some minor tweaking most things came over, except for the flash movies. The flash movie was not being displayed. So naturally you think – must be a path, permission, activeX, flash object declaration, upload or even a masterpage might need a tweak… Fired up FireBug in firefox and went to work – we could access the *.swf file directly from within the browser, but when the Page loaded with the link in there… no go. In fact we got a ‘304 not modified’ response within FireBug – which seems pretty normal if the flash player already has the movie locally and it’s just comparing the server version versus the local…but still no flash playing. SharePoint 2010 Web Applications restrict ‘active’ content – aka Flash out of the box. After some digging and a seemingly unrelated option appeared in Web Application –> General Settings. Browser File Handling - Default setting: STRICT This was the culprit, setting this to permissive did the trick. Wow! Have a great weekend folks!
Breeze SharePoint 2010 Bootcamp The Breeze SharePoint 2010 Bootcamp is here! Breeze SharePoint 2010 Bootcamps – Building Real World Solutions
The eagerly anticipated SharePoint 2010 Bootcamps are underway in Australia, and here’s what some of the excitement is about. Technical training this year is all about value for money. After the change in the economy, customers are more careful about where their training budget is being allocated. This year, customers need technical training that is relevant and an investment to their business. They are looking for knowledge that will improve business efficiencies, provide real world scenarios and give students the confidence to be hands-on when they leave the classroom.
The new Breeze SharePoint 2010 Bootcamp has been designed to provide just that. Our customers asked for an in-depth, technical, customized course that, if they were to spend $$s on just one SharePoint 2010 course this year, would give them enough knowledge of the technology to build real world solutions. These bootcamps have been written for the ITPro & Developer who need to upgrade their SharePoint skills, or are just starting out with SharePoint 2010.
Be ready to roll up your sleeves and start your adventure here. Sydney: 2nd August 2010 Price: $3450 ex GST Register NOW: info {at} breeze {d.o.t.} net *Quote this blog article to receive a special promotion. Enjoy, Mick. p.s. anyone seen the octopus…I’ve got destiny with it….
Folks this is too good to be left out… There’s an Octopus named ‘Paul’ that’s predicted 5 from 5 of Germany’s last results (wins + losses), with his previous success rate for the Euro 2008 being 80% where he wrongly predicted Germany would beat Spain and Spain won. Now, with the Semi finals very close, the Octopus has predicted Spain to win. Essentially his prediction is – they drop 2 cubes each with the nations flag on it, and in the cubes they have his ‘dinner’ (a muscle). The cube he opens the lid to first and eats the muscle is his prediction. http://www.abc.net.au/news/video/2010/07/07/2946732.htm Let’s see how he fairs tomorrow morning (my time). 
Sorry I’ve been quiet folks – I’ve been sleep deprived, not really knowing which day is what and…I guess it’s like having a new born again. :) My extended family is English and they sent through a cracker…. See you soon, Mick.
As you know I’m a big fan of Virtual Box being able to run my x64 VMs on my Win7 machine. Yay!! So armed with my trusted new Core i7/8 GB laptop – I figured the VMs will be cooking on this new kit… After installing the lastest VirtualBox (3.2.0) I was away – only to notice the machines were running like a SLUG! (I actually have a cat that has the nick name ‘slug’ and this machine was slower than her) After waiting a full 20mins (still booting - ‘loading windows files…’ etc) my machine Blue Screened for a millisecond and then rebooted. So I rolled up my sleeves and started digging – could be the VHD, the bios, the machine, the 1000 and 1 settings… Firstly I ran a command line command (from under the vbox install dir) - VBoxManage setextradata VMNAME "VBoxInternal/PDM/HaltOnReset" 1 Finally I got a glimpse of the BSOD and it was an error “…STOP…7B…” I twigged this is an error of “Inaccessible boot device….” which I’ve had several times when the SATA drivers couldn’t be loaded by the O/S during boot up. Solution: (in my case) I configured the Virtual Box VM with IDE Storage Controllers and NOT SATA ones for the bootup.(still connected to the same VHDs though) Win2008/R2 boots up and I’m able to load the SATA drivers in and we’re away. Back to BizTalk 2010 Beta playing…. :)
Wow! I'm finally through the other side... what a quest and I thought I'd share some of the details with you.
RFC_READ_TABLE rfc can be used to call into SAP and retrieve table data - *sort of* (and that's a big sort of) like a 'DataSet'.
Using it requires a little work and understanding.
In your either BizTalk project or other project from VS.NET:
- Add the SAP bits to your VS.NET project - ready for action
- select 'Add Adapter Service Reference' (for BTS projects -> Add New Generated Item->Consume Service Adapter...)
- On the Binding Wizard Screen select sapBinding and configure the appropriate connection string details such as:
string sapUri = "sap://CLIENT=800;LANG=EN;@A/sapsrv/00?GWHOST=sapsrv&GWSERV=sapgw00&RfcSdkTrace=true"; <You need to stick your own sapURI above - that is more or less a sample>
- Click on the Connect and under RFC->OTHER , select RFC_READ_TABLE (or you can type it in the box to search)
- Click Ok to generate the proxy and other details.
- Either your BizTalk Project or your non-BTS project has now all the relevant details to communicate to SAP.
I tend to build out all this functionality first in a Console App just so I know what is needed within the BTS environment, also I find it much quicker to test/debug etc. here.
- Ok - onto the code. I've got 2 routines for you, one that uses the Proxy Classes built by the wizard in the last step, and a routine from 'first principles'.
One of the things that I really like about the BTS Adapter Pack and certainly in this case, is that depending on the shape of the XML you pass to the adapter, it determines the table and type of operation that it is to do.
Both of these examples below you could wrap into a functoid/helper/whatever and use directly from code.
- Proxy Code - version 1 - here I define some parameters and make a straight call to the table CSKS.
NOTE: Use FieldNames not Field Labels (took me a few hrs on that one ;)
using LOBTYPES = microsoft.lobservices.sap._2007._03.Types.Rfc;
private static void GetDataFromSAP() { RfcClient clnt = new RfcClient(); //myproxy client string[] data = GetAppDetailsForCurrentUser("SAP"); clnt.ClientCredentials.UserName.UserName = data[0]; clnt.ClientCredentials.UserName.Password = data[1]; LOBTYPES.TAB512[] rfcData = new microsoft.lobservices.sap._2007._03.Types.Rfc.TAB512[0]; LOBTYPES.RFC_DB_OPT[] rfcOps = new microsoft.lobservices.sap._2007._03.Types.Rfc.RFC_DB_OPT[0]; LOBTYPES.RFC_DB_FLD[] rfcFlds = new microsoft.lobservices.sap._2007._03.Types.Rfc.RFC_DB_FLD[] { new LOBTYPES.RFC_DB_FLD() { FIELDNAME = "KOSTL", LENGTH=10 }, new LOBTYPES.RFC_DB_FLD() { FIELDNAME = "DATBI", LENGTH=8 }, new LOBTYPES.RFC_DB_FLD() { FIELDNAME = "DATAB", LENGTH=8 } }; try { clnt.Open(); clnt.RFC_READ_TABLE(";", string.Empty, "CSKS", 50, 0,ref rfcData, ref rfcFlds, ref rfcOps); Console.WriteLine("RFC RESPONSE\r\n\r\nData:" + rfcData.Length.ToString()); } catch (Exception ex) { Console.WriteLine("ERROR: " + ex.Message); } }
- More from first principles so this is to give you more of a BTS picture.
NOTE: The use of the '%' sign to get a wildcard match on a KOSTL field, despite in the SAP Client UI the users enter a '*'
private static void GetDataFromSAPV1() { string[] data = GetAppDetailsForCurrentUser("SAP"); SAPBinding binding = new SAPBinding(); //A reference to Microsoft.Adapters.Sap is needed. //set up an endpoint address string sapUri = "sap://CLIENT=800;LANG=EN;@A/sapsrv/00?GWHOST=sapsrv&GWSERV=sapgw00&RfcSdkTrace=true"; EndpointAddress address = new EndpointAddress(sapUri); try { ChannelFactory<IRequestChannel> fact = new ChannelFactory<IRequestChannel>(binding as Binding, address); // add credentials fact.Credentials.UserName.UserName = data[0]; fact.Credentials.UserName.Password = data[1]; // Open client fact.Open(); //get a channel from the factory IRequestChannel irc = fact.CreateChannel(); //open the channel irc.Open(); string inputXml = "<RFC_READ_TABLE xmlns='http://Microsoft.LobServices.Sap/2007/03/Rfc/' xmlns:ns1='http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/'>" + "<DELIMITER>|</DELIMITER>" + "<QUERY_TABLE>CSKS</QUERY_TABLE>" + "<ROWCOUNT>10</ROWCOUNT><ROWSKIPS>0</ROWSKIPS>" + "<DATA /><FIELDS>" + "<ns1:RFC_DB_FLD><ns1:FIELDNAME>KOSTL</ns1:FIELDNAME></ns1:RFC_DB_FLD>" + "<ns1:RFC_DB_FLD><ns1:FIELDNAME>DATAB</ns1:FIELDNAME></ns1:RFC_DB_FLD>" + "<ns1:RFC_DB_FLD><ns1:FIELDNAME>DATBI</ns1:FIELDNAME></ns1:RFC_DB_FLD>" + "</FIELDS>" + "<OPTIONS>" + "<ns1:RFC_DB_OPT><ns1:TEXT>KOSTL LIKE '1234%' AND BUKRS EQ '63' AND KOKRS EQ 'APPL'</ns1:TEXT></ns1:RFC_DB_OPT>" + "</OPTIONS>" + "</RFC_READ_TABLE>"; //create an XML reader from the input XML XmlReader reader = XmlReader.Create(new MemoryStream(Encoding.Default.GetBytes(inputXml))); //create a WCF message from our XML reader Message inputMessge = Message.CreateMessage( MessageVersion.Soap11, http://Microsoft.LobServices.Sap/2007/03/Rfc/RFC_READ_TABLE, reader); //send the message to SAP and obtain a reply Message replyMessage = irc.Request(inputMessge); //create a new XML document XmlDocument xdoc = new XmlDocument(); //load the XML document with the XML reader from the output message received from SAP xdoc.Load(replyMessage.GetReaderAtBodyContents()); XmlNodeList nds = xdoc.DocumentElement.SelectNodes("//*[local-name()='WA']"); foreach (XmlNode nd in nds) { string[] parts = nd.InnerText.Split('|'); Console.WriteLine("CC={0} From: {1} To: {2}", parts[0], parts[1], parts[2]); } xdoc.Save(@"d:\sapout.xml"); irc.Close(); fact.Close(); }
catch (Exception ex) { Console.WriteLine("ERROR: " + ex.Message); } }
Well if you’re cracking on and updating your SharePoint Beta 2 Installs to RTM and wanting to make it out the door while there’s some daylight left…then you’re better than me…right now it’s dark! :) Ok – so I figured, no probs just do a stsadm –o addcontentdb … and we’re well on our way, exactly the same from Beta 1 to Beta 2. This time SharePoint RTM doesn’t want to play. I got this error: Sequence [Microsoft.SharePoint.Upgrade.SPContentDatabaseSequence] cannot upgrade an object [SPContentDatabase Name=WSS_Content_Int2010] whose build version [14.0.4536.1000] is too old. Upgrade requires [14.0.4730.1000] or higher. So as you can see the Version numbers of my Beta2 ContentDB is close, but RTM is not playing. I thought I’d take a punt and see what happened: -
Open up the ContentDB in SQL Management Studio and open up the Tables folder. -
Locate the Versions Table (down the bottom). -
Open the Versions Table in Edit Mode and modify the Rows which have a Version=14.0.4536.1000 next to them. -
Simply change the version number to 14.0.4730.1000 -
Save the changes -
Rerun the stsadm –o addcontentdb command and bob’s your uncle. The ContentDB I used here was 18GB in size and all has come up trumps. This may save you a bit of time and sure it’s a hack, but we’re now in RTM land. Good luck :) 
I’ve just spent the past couple of days looking into the ‘upgrade’ process and I’ve come out the other side. Here’s a quick jot down of what I encountered - Environment: Single WFE (Win2K8 R2 x64) and a separate SQL 2008 x64 'backend’. Currently running SP2010 Beta2 with content databases around 13GB
- I haven’t uninstalled any of the existing SP2010 beta 2 bits – this is a VM and I have a handy backup, so in case of emergency break glass was my plan b.
- Launched Setup.bat – up came the intro screen and I selected Install PreReqs. In my case the prereqs failed their first installed with it grumbling about the IIS Web Role not present (but this was an existing SP2010 server, so obviously the Web Role was present and correctly running).
Ran the PreReqs again and all was fine :) - Setup.exe – launched the product, provided a license key and we ran all the way through no problems. Interestingly thRege installer didn’t mention anything like “…I found a previous version of SharePoint do you want to …”
- Configuration Wizard – this is where my trouble started.
- As the Wizard was launching, it appeared not to be able to recognise the fact that we were already in a farm. It was like we were running on a machine, where the DB Server wasn’t accessible.
I ‘removed’ the Server from the Farm (which were the only options in the Wizard for me) - Re-ran the Wizard Take#2, supplied the details at the beginning, Server Farm etc etc and sent it on it’s way.
- The Wizard ran up to step 3 of 10 (where it configures the Farm DB + creates the SharePoint Web Services IIS Site) and then FAILED. What I noticed that the FarmDB was created successfully, but the IIS side was failing.
(The error logs spoke about a socket based error – which I think was unrelated) - Tweaking, rerunning the Wizard didn’t fix things…so here’s my fix….
- I also uninstalled SP2010 RTM a few times and reinstalled, but same error
- The fix -
- Delete the \14 hive
- Delete the Registry Key (and all under it) HKLM\Software\Microsoft\Shared Tools\Web Server Extensions
- Uninstall/reinstall the IIS Web Role on the Server
- Repair the SharePoint install from rerunning Setup.exe – repair option. (you might be able to leave this step out, but I deleted the Web Server Extensions key after I installed SP2010, so I needed it to be rewritten)
- Run Config Wizard
- Upgrade any Content DBs you want to mount – through stsadm –o addcontentdb or Mount-ContentDB (powershell)
I’m sure you’ll be able to shorten this list of steps when you upgrade, but I’ve got to get on and configure this environment. Have fun, Mick.
|