|
| This is a blog post that I looked forward to writing; this post deals with a problem that has plagued SharePoint Workflows when limited to using SharePoint Designer, and a solution is here now in SharePoint 2010 using Sandboxed Solutions. What problem is this you may ask, well it is the means by which you implement a loop structure in your workflow, you may notice that here is no such activity as an available option in SharePoint Designer 2007 or 2010, hmm I wonder will it be in the next version? J Inquiring minds want to know.
Problem Stated
You have two SharePoint Lists, data elements in List A are related to data elements in List B. You want to make a change to a singular item in List A and for every related element in List B, you want to effectuate a change as well.
In practical terms lets say that you have a pool of candidates that you plan to hire, those candidates are in List A, they will go through a list of interviews with individuals and teams. You want a workflow such that if (1) During the process, the candidate drops out of consideration [Cancelled], is put on a wait list [Deffered], or "knows someone" so they don't need all those formalities[Approved].. I know im stretching on the last one. But basically you want it, for as many people involved in that process [List B], for it to update the status of that candidate to those (for now) Deffered and Cancelled status.
How would you do it if you were limited to creating the workflow in SharePoint Designer 2010?
Above: List A – The Candidates Table (Before Shot)
Above: List B- The Interview Board Tasks (Before Shot)
Solution Design
Now, there are several post and guidance's out there in the Blog-osphere that speak to solutions that employ using Multiple List and Libraries to act as counters with delay activities to ensure that the timing is maintained between iterating through the items in LIST B when the helper table managing the counter is in a work state; now I have my opinions on those solutions, but notwithstanding that, I fully understand that those solutions in the past were necessary in order to get the job done. Enter today with SharePoint 2010 and Sandboxed Solutions; this affords us the ability to write targeted solutions that are scoped at the Site Collections level and accessible through SharePoint Designer tooling, here is an excerpt of what a Sandboxed Solution is taken from Microsoft's site.
"A sandbox is a restricted execution environment that enables programs to access only certain resources, and that keeps problems that occur in the sandbox from affecting the rest of the server environment. Solutions that you deploy into a sandbox, which are known as sandboxed solutions, cannot use certain computer and network resources, and cannot access content outside the site collection they are deployed in. For more information about solutions, see Solutions Overview(http://go.microsoft.com/fwlink/p/?LinkID=156638)."
Approach
Using Custom Workflow Activities, create a loop structure to look for changes in List A (on changed event fires) and then traverse List B, looking for the qualifying criteria that will count as a match in List A, then update that item. Loop through the entire list until all every list item has been evaluated. This logic will be encompassed in a Method of a Class you will create, the class must be scoped "public" and the method will take as a parameter "SPUserCodeWorkflowContext" object and it will return a type of Hashtable, also remember that your feature needs to be Scoped at "Site".
- Create a Visual Studio Empty SharePoint Project that is Scoped to the Sandbox
- Create Logic to use the SharePoint API to traverse items in List B based on changes in List A
- Deploy the Solution, open up SharePoint Designer for the Site Collection it is Activated on
- Use the Custom Activity in SharePoint Designer as you would for any other OOB Activity
Build
- Create your SharePoint Project
Begin by launching Visual Studio and create an Empty Project, scoped at Sandboxed Solution in the Project Properties or as you are setting up your Project for the first time. Next add a Class to create the method.
You are not over quite yet, now you need to make this available to SharePoint Designer, we do that by adding an Empty Module to our project. In my example below I am calling it CASDefinition and it includes and Elements.xml file that I will modify as such…
You will notice that the structure of the file lends itself to how it will be viewed and used in SharePoint Designer; also there is a reference to the class file function names, class names[lines 4 through 8], what category (placement)[my self serving line 10] it will appear in SharePoint Designer. Next you have parameters, now certainly here I could have made this configurable by taking the List name as an input Parameter or maybe a specific parameter that I wanted to update rather than all, but this is a demo, you get the idea, for now I have an output parameter.
By now, your project should look like this below.
A few housekeeping notes here, I did mention it above but just to re-inforce it, please change the Feature File to "Site" Scope so it is available at the Site Collection level, and you can see in the project properties that the "Sandboxed Solutions" property is set to true. One more thing, you will see that there is another project in there, "CASTester", that is just a console app I use for testing ANY solution logic, it is not necessary for this to work.
Assemble your SharePoint Designer Workflow
Now that you have deployed your package, you should see it as an available option in SharePoint Designer 2010 under Workflow Actions.
Notice the Fabian Custom Actions section and the Name of the Custom Workflow Activity therein. Now at this point you can set this workflow to run on a Changed Event in List A, or set it for Manual, either way, when it runs, it will subsequently change all items related in List B accordingly.
Above: List A – The Candidates Table (After Shot)
Above: List B- The Interview Board Tasks (After Shot)
Conclusion
So now you have a tried and tested way of doing Loops in SharePoint Designer 2010 albeit through a Custom Workflow Activity within the boundaries of a Sandboxed Solution in SharePoint 2010.
Cheers, happy SharePoint-ing
|
|
There is no way that I could do this in 140 character or less; I tried, but it butchered the meaning/conveyance of my message. So, this week and the last I am working on a project(s) that are not necessarily hard as much as one of them, I needed a sanity check, and the other, I definitely needed help… it was JQuery and SharePoint Designer stuff (run on sentence I know), and as much as these events are not limited these two events or these two individuals, sometimes when good fortune falls on you, you have to make it known so that, in part, people who are struggling understand that there is a community out there to help.
So, that said, I want to thank Bart X. Tubalinal ( @bart_tubalinal) and Matthew Bramer ( @ionline247) for taking time out of their busy days, at times after work hours, over lunch time, to work with me [and im sure others] disseminating their hard earned knowledge FOR FREE to the benefit of others.
Cheers mates!
|
| Thank you all for attending my Session at the inaugural Office 365 Saturday at the Microsoft Campus, Redmond Washington.
Here are my Slide Decks
Session 2: Migrating a Classic ASP Site to Office 36 with CSOM & REST Services – A Case Study
|
|
This table lists the services that appear on the Services on Server page in Central Administration and provides additional topology guidance, if it applies. Note that Search service application components are deployed to servers by using the Search Administration page, not the Services on Server page.

|
| First, let me qualify the below by saying that “this is accurate at the time the blog post is written”… ok now that we got that out of the way. Second, This information below is compiled from my experiences (Ive done a few Office 365 (SharePoint Online) projects to date) information I have garnered from esteemed SharePoint/Office 365 Experts, and guidance from TechNet & MSDN. In fact for an exhaustive list of guidance on Office365 I recommend you go here
Office 365 for Enterprise Service Descriptions and pull down all the information you will need on Exchange, Office, Lync and SharePoint.
So, to the crux of the matter, as I prepared for another assignment at work, I began researching, the premise being, “What should you (the consultant or the client) consider BEFORE making a decision on implementing SharePoint On-Premises “or” SharePoint Online (Office 365). Now this is by no means an exhaustive list, in-fact I would dubb it, “things you should know before you consider SharePoint Online over SharePoint On-Prem”. But before the tar and feathering, you should understand that I like SharePoint Online, I am one of the biggest cheerleaders, but as with anything/any tool, you need to know “when” to use it.
Top 15 things you should consider when thinking about SharePoint Online (Office 365)
- Each My Site gets 500MB of personal storage. This amount cannot be adjusted.
- The My Content part of a My Site is not provisioned until the user clicks on My Content from their My Profile page. After they do, a personal My Site site collection is created. This does not count against the 300 site collection limit as that applies to non-My Site site collections.
- BCS within SharePoint Online does not support a direct connection to SQL Azure. A WCF endpoint is required. -- See my Blog on how to do this with WCF here http://www.sharepointfabian.com/blog/Lists/Posts/Post.aspx?ID=212
- Access reporting is not supported by SharePoint Online Access Services because SQL Server Reporting Services (SSRS) is not currently enabled for SharePoint Online. Access reporting requires SSRS.
- SharePoint Online does not support auditing capabilities to log the opening and downloading of files in a document library.
- SharePoint Online does not support PerformancePoint Services.
- SharePoint Online does not support Excel Services and PowerPivot for SharePoint
- PDFs and other types of files can potentially run scripts against sites. To prevent this security threat, SharePoint Online requires users to download these types of files. When the user tries to open a PDF document stored in a SharePoint Online document library, the user will see a “Save As…” window and must download the PDF file to their local directory.
- SharePoint Online does support Enterprise Search, but does not currently support FAST Search.
- Vanity URLs can only be applied to the public website. Customers cannot apply a vanity URL to an intranet zone site.
- Editing the Public Website with SharePoint Designer is not supported. SharePoint Designer 2010 cannot be used to edit the public website. This site can only be edited with the built-in Site Designer tool. SharePoint Online only supports SharePoint Designer 2010.
- SharePoint Online development patterns and practices are currently targeted at site collection level solutions.
- “Server Resources” quota, what are used to determine amount of processing power available to Sandboxed Solutions, is determined by the number of licensed user seats in a company's tenancy. To calculate server resource quota in Office 365, you can use the following equation: (#seats×200) + 300.
- SharePoint Online does not currently support customer use of Windows PowerShell for service administration.
- You cannot create property based search scopes in Office 365 (SharePoint Online) -- Credit Wictor Wilen at http://www.wictorwilen.se/Post/You-cannot-create-property-based-search-scopes-in-Office-365-SharePoint-Online.aspx
Things that Flat Out are not available in SharePoint Online but ARE available in SharePoint 2010 Server
- Timer Jobs
- BCS Profile Pages
- Business Data Integration with the Office Client
- Audit Opening and Downloading
- Records Center
- Word Automation Services
- Business Intelligence Center
- Chart Web Parts
- Data Connection Library
- Dashboards
- Decomposition Tree
- Advanced Content Processing
- Tunable Relevance with Multiple Rank Profiles
- Business Intelligence Indexing Connector
- SharePoint 2010 Search Connector Framework
- Deep Refinement
- Federated Search
- Query Suggestions, "Did You Mean?” and Related Queries
- Relevancy Tuning
- Rich Web Indexing
- Similar Results
- Thumbnails and Previews
- Visual Best Bets
- Advanced Sorting
- Web Analytics
So, with this, I hope you are thus more informed and can make better decisions.
Cheers, and Happy SharePoint-ing See you at the next SharePint! |
| Part 1: All about the Data – Databases, LINQ to SQL, WCF Data Contracts Part 2: In deep with WCF – Looking at the methods that will assist us in our ECT and Testing Part 3: Introducing SharePoint Online BCS – All that you need to configure in SharePoint Online to consume WCF Services for ECT Part 4: SharePoint Designer Components – Creating your ECT, EL, and your Results This is truly an exciting time for SharePoint and especially BCS and it enters the realm of the Cloud. Data is now truly universal. Introducing SharePoint Online BCS – All that you need to configure in SharePoint Online to consume WCF Services for ECT There is a lot that can be said here but if you read the Acknowledgements section of part 1, you will get all the information you need. I will back fill this eventually with lessons learned, but for now the below shows what is available to you in the Admin Options for SharePoint Online. You will be using the Manage Business Data Connectivity Option to review the ECT’s and perhaps add permission to the groups or individuals that can see/use the ECT and create them in SharePoint Designer. Above is the Admin Tools to drive SPOnline (O365) earlier on I used Secure Store when I was Direct Connecting to SQL Azure, but that is no longer supported. For the WCF I used basic Bindings over http, so no credentials are needed. Below shows the ECT’s as are there now, you will notice in part 4 that a new one is added. |
| Part 1: All about the Data – Databases, LINQ to SQL, WCF Data Contracts Part 2: In deep with WCF – Looking at the methods that will assist us in our ECT and Testing Part 3: Introducing SharePoint Online BCS – All that you need to configure in SharePoint Online to consume WCF Services for ECT Part 4: SharePoint Designer Components – Creating your ECT, EL, and your Results This is truly an exciting time for SharePoint and especially BCS and it enters the realm of the Cloud. Data is now truly universal. SharePoint Designer Components – Creating your ECT, EL, and your Results After all that effort, now its time to see some fruit of your labor. So what we are going to do here is to use SPD 2010 to connect to your SharePoint Online (Office 365) site and create an External Content Type. Thereafter you will create an external list either in SPD or via the browser. Now a couple of things that you may or may not find funny, but at least interesting. You will remember that initially in my acknowledgements, I mentioned that Christian did a blog that demonstrated how to use SQL Azure through a direct connection to SharePoint Online, however that is no longer supported. In addition to that, “using the templates provided from Microsoft in Visual Studio 2010” You cannot create a .NET Assembly for SharePoint BCS in Visual Studio in SharePoint Online (Office 365) because it is by default a Farm Solution and SPOnline requires Sandbox Solutions. Now looking at what we have below you can see in SPD there are three options to create an External Content Type OOB, of which now we know 2 of them are not permissible when working with SQL Azure. Regardless, for our example today , we will be consuming a WCF, so go ahead and click WCF. Once you do you need to provide the Metadata URL (your endpoint with ?WSDL) so that the operations may be discovered. As far as the EndPoint as you can see in my example below, I am specifying the basic Endpoint as well. For the rest, accept the default. Once you have selected or provided the information in the above diagram, click OK you should see the dialog below based on our Nomenclature. I have expanded it out so you can see all the operations in the WCF as indicated below. The above diagram shows all the available operations for you to use against the WCF. Thought it doesn’t jump right off the page, we have all the operations we need (minus the Delete Method and I told you why earlier) to go to town here. Simply right click on “a particular” method call and select the BCS option you need. Above is the Read List Operation that is selected by right clicking on the GetSpeakers Method, simply follow the wizard to complete the operation. Above is the Read Item Operation that is selected by right clicking on the GetSpecificSpeakers Method, simply follow the wizard to complete the operation. Above is the Create Operation that is selected by right clicking on the AddSpeaker Method, simply follow the wizard to complete the operation. Above is the Update Operation that is selected by right clicking on the UpdateSpeakers Method, simply follow the wizard to complete the operation. Once you have completed that exercise, then click on the little blue “Save” disk icon in the ribbon to save the ECT to the Metadata Store. Once that is completed then from SharePoint Designer we can create a new External List as is below. By going to the Browser, you can see below that we have an External List in the browser. By clicking on an item in the External List you see we have the ability to View or Edit the data. By clicking in the ribbon under “Items” you can create a new Speaker as denoted below. A point on that for some of our astute readers. you can see below that the Contact ID is required to be filled out, now I could have handled that a few ways, but in my WCF I am not even doing anything with it regardless of anything placed in there, BUT you must place something in there based on who I have it configured now. We can clearly Edit information as you can see below as well. And just to be complete, you can view an individual as well. You will notice that as an external list you DO NOT HAVE access to all the operations (when looking at the list settings window) as expected because this list is not stored in SharePoint and faces all the limitations of that accordingly. So in conclusion, this blog demonstrated how to use a WCF to create an External List via a External Content Type in SharePoint Online. I hope that this blog helped out someone in this pursuit. I will be building up this example as we move forward for additional demos. Cheers and Happy SharePointting… See you at a SharePoint or Office365 Conference near you. |
| Acknowledgements
Before going even one stitch in this blog post I must recognize two individuals who have already done some public post on this topic that I am building upon. Christian Glessner (twitter: @cglessner) and blog post http://www.ilovesharepoint.com/2011/11/connecting-sql-azure-with-sharepoint.html on November 5th 2011 demonstrated how 'at the time' one could use SharePoint Designer to Direct Connect to Microsoft SQL Azure and surface data on SharePoint Online. Subsequently a short time thereafter, that function was no longer supported as a means to connect to SQL Azure. Steve Fox (twitter: @redmondhockey) on November 12th 2011 did a post http://blogs.msdn.com/b/steve_fox/archive/2011/11/12/leveraging-wcf-services-to-connect-bcs-with-sharepoint-online.aspx where he demonstrated how to accomplish the same task via WCF. Steve ("Dr. Fox") blog went into the creation of the External Data (LOB System), creating the WCF Service, and creating the External Content Type using Read List and Read Item Methods. Steve mentioned he would do some more complicated ones and explore more binding options… that is where I stepped in.
Introduction
If you have ever read any of my blog post before, you know it comes with a story, a business case if you will and usually will demonstrate something you can take into the real world. In this example you will learn how to create a fully CRUD External Content Type (ECT) from a WCF that has methods to support that action. You will then see exactly how to configure and set up your SharePoint Online (Office 365) Site to support connectivity, and consumption of the WCF service and finally return an External List from the ECT that will be placed in SharePoint Online.
The scenario here is actually appropriate to the Speaker community I am a part of, we have a database below that takes
- Contact Type – you can be a speaker, organizer, volunteer, host, etc
- Contact – mapped to a Contact Type and maintains the personal data of the individual
- Event – An event that the contact will be at
- Contact Event – in the case of a Speaker, this is where you have lets say a session and possibly two speakers, this records that transaction and additional data
- Evals – Anyone can fill out an Eval on the speaker(s) of a particular session
Although our blog post will have additional Methods, we will limit our focus on the Speaker: (1) Returning All Speakers (2) Returning a Specific Speaker (3) Updating a Current Speaker (4) Adding a New Speaker. Finally, because this will be an involved process and meticulously detailed. I will be breaking this up into the below parts as a means to make it more readable and so that the page load will be better with all these images.
Part 1: All about the Data – Databases, LINQ to SQL, WCF Data Contracts
Part 2: In deep with WCF – Looking at the methods that will assist us in our ECT and Testing
Part 3: Introducing SharePoint Online BCS – All that you need to configure in SharePoint Online to consume WCF Services for ECT
Part 4: SharePoint Designer Components – Creating your ECT, EL, and your Results
This is truly an exciting time for SharePoint and especially BCS and it enters the realm of the Cloud. Data is now truly universal.
Now.. Part 1..
Part 1: All about the Data – Databases, LINQ to SQL, WCF Data Contracts
As previously mentioned, this blog is looking at a business case, in our situation we have five (5) tables. You will look at them one at a time
SQL Tables for our Databases
Basically we open up Database Designer in SQL Management Studio and create the following Tables, create the relationships between them and save them back. I have kept the data types simple because BCS is finiky with complex data types. Primary Keys is set to auto increments, the rest is varchar and probably a simple date time somewhere in there.
The above table sets the stage for us to use one table to hold people data, by maintaining the category of that person here, for our business case, we have a speaker type that is CID int value 100
The table above holds person data, takes on the foreign key CID which separates each person into categories
The above table holds information about Events that contacts will find themselves at; some are speakers, some are event organizers, some are volunteers, etc.
Just like your "Order Details" table in AdventureWorks and Northwind Databases, this "ContactEvent" Table is how we relate multiple events to multiple speakers in a single table. Additionally it provides Event specific data such as Session name, a means to determine if a speaker is a presenter or co-presenter and Average Eval Score
Finally the above table actually takes an electronic form of the Eval sheet that we usually see at SharePoint Saturdays. TC represents "The Content" and TI reperesent "The Instructor" Foreign Keys are there as well to tie to the presenter and copresenter from the ContactEvents Table, thus completing the picture. In the end here, we have the foundation of what can be a simple data tier to an application to track Evals from Speakers at Events.
Visual Studio Database Model File
From time to time I will be making some leaps in assumption, or Ill expect you to go back to either my earlier posts to see how to accomplish some tasks or already know how to do it. In this case, the following is already done and we are stepping in thereafter
Already Done:
- Visual Studio Project already Created
- WCF Service Library Template used
As we will Windows "Communications" Framework (WCF) will be communicating with a Database, for simplicity sake I am adding LINQ to SQL to the project, connecting to the Server where the Database is located and bring across Table and Views as objects in our project. This will allow you to have immediate access to a Data Context and classes that represent the tables in the database which implements IQueryable and IEnumerable to keep our coding down to a minimum. Below represents that.
The above model shows a SQL View that was created in the database and brougnt into our project. In addition to that, we have other tables, but the one that is important to us is the Contact Entity that we will be making a CRUD ECT for. In a later post, I will be demonstrating usages for the additional entities, but that is for a Windows Phone 7 App I am writing J The relationship is automatically added when you drop the tables in the design pane. The Data Context takes the name of the dbml file.
WCF Data Contracts
Although not dependent on it, after you have completed the LINQ to SQL model, as with almost all my Visual Studio Projects, I delete the sample class/helper files that it provides when you fire up a new template and create my own. In this case you are creating a Data Contract to represent the objects that will represent the underlying tables in the SQL database "and" that will be available to the End Users via the WCF End Point. For completeness, and so others can use this as an example to do their own work, I am including all the data contracts in the WCF but what you need to be concerned about is the ones related to the Contact Entity
When it comes to WCF Data contracts one important thing to remember is that you need to annotate the public class with the [DataContract] attribute as well as annotating the fields "that you want to be available to the end users" with [DataMember] attribute. The same goes for the rest below
That is it as far as Data Components and it stems between SQL and Visual Studio. Next will be Part 2 where you will go into the Methods of the WCF surrounding the Contacts Entity in particular.
|
| This blog is part 2 of a 4 part series on the above topic. Here is a listing of all the post in the series
Part 1: All about the Data – Databases, LINQ to SQL, WCF Data Contracts
Part 2: In deep with WCF – Looking at the methods that will assist us in our ECT and Testing
Part 3: Introducing SharePoint Online BCS – All that you need to configure in SharePoint Online to consume WCF Services for ECT
Part 4: SharePoint Designer Components – Creating your ECT, EL, and your Results
Enjoy…
Part 2: In deep with WCF – Looking at the methods that will assist us in our ECT and Testing
Last we left off we had the data component completed up to the data contract in the WCF, in this post you will see how to create the Service Contract and the Implementation of the Service Contract Interface. To do that, you will add a new class to the project, this is really an interface to annotate it as such as indicated below.
So to start off, just as in the Data Contract we need to make some annotation to this file as well in order for it to be a WCF Service Contract. Label the interface with [ServiceContract] and the Methods with [OperationContract], once that is done, then we need to define what operations we want to undertake. Here is where for the first time we have an eye on the SharePoint External Content Type and External List. So, to make an External Content Type you need at a minimum two methods, Read List and Read Item, basically one to return a list of what you are trying to surface and the other to return a single item when one it is needed out of the list. In our case; i.e. our WCF operation, we will be using the following:
- List<Speakers> GetSpeakers()
- List<Speakers> GetSpecificSpeakers()
GetSpeakers is representive of our Read List External Content Type Method and returns all the speakers in the SQL Contact Table where CID is equal to 100
GetSpecificSpeakers is representive of our Read Item External Content Type Method and returns a single speaker in the SQL Contact Table where a contactId is passed in as a parameter
In addition to that because we want CRUD activities we also need a Create Method, Update Method & Delete Method (now the delete I will show you in the blog but I wont implement it.. just because I don't want a way to delete any of my data without a person on the SQL box J I mean do u blame me.. )
- String AddSpeaker (Speakers speaker)
- String UpdateSpeaker (Speakers speaker)
- String RemoveSpeaker (int contacted)
In these methods we are returning a string simply for the purpose of acknowledgement of what was done, i.e. did it work or didn't work… however our ECT wont use it, that's just for the WCF when used in other places than SharePoint BCS; like I said, I plan to write a WP7 App to do this as well. And just to round it out..
AddSpeaker is representive of our Creator External Content Type Method and adds a single Contact to the SQL Contact Table where CID is equal to 100
UpdateSpeaker is representive of our Update External Content Type Method and modifies a single item in the SQL Contact Table where a Speaker is passed in as a parameter
RemoveSpeaker is representive of our Delete External Content Type Method and removes a speaker in the SQL Contact Table where a contactID is passed in as a parameter
Now the code…
Now it goes without saying that Im not going to put my servers name, username and password out there to John Q Public, so replace the "my…" with your instances please in the Connection String, which by the way could have been put in a App.Config file but Im lazy and this way, if you see it over and over again, you will learn it better huh? I also know that there are MANY, Many, many way that we can write code, this is my way… don't like it.. do it your way J
The above is the GetSpeakers Method
The above is the GetSpecificSpeakers Method, the only difference in this method and the last is that it takes a parameter to locate the unique contact.
The above is the Creator Method, nothing much to say here except Im starting to use Try Catch braces… yah, I should have them above as well, oops.. doesn't hurt unless I really goof something though..
Lastly the Updateor Method is above, now I have a few more that we can discuss in another blog post, but for now this gives you what we need for SharePoint Online (Office 365), next we will turn our attention to testing this WCF and get it ready to be hosted in a publicly accessible IIS (Web Site/Application) so we can consume it from Office 365.
Configuring our WCF, Configuring our IIS and Testing our WCF
So, at this time, this has NOTHING to do with SharePoint Online (Office 365) or BCS, but since you have spent all this time learning about WCF, lets talk about how you configure it to work, (based on HOW I created it in the first place) and how you get it to IIS so it may be called from SPOnline (O365)
- ReConfigure your App.Config – Remember that the stupid template when you begin a project was set for Service1.svc; we deleted that to create our DataContract, ServiceContract Interface and Implementation. Well, our App.Config needs to know where our Dlls are.
Right Click on the App.Config and click "Edit WCF Configurations" when you do that, you will see…
Where you see Service1.svc click the ellipse next to the name, and go to the bin directory in the folder dialog box that will come up and find your files that you created. One thing to call out here is that the bindings here for our EndPoints are wsHTTP and mex; I wont get too much into that now, but NOT HERE, but in our Web.Config we will add httpBasic binding because we are coming across the internet and we want to impersonate/use service account for access to WCF, wsHttp will need us to pass credentials and I don't want to complicate this blog post with that, well not yet.
Once you have done that, you basically have a working WCF that you can test using the WCF Test Client CommandLine Utility that ships with Visual Studio… see below, and yes, I blacked/whited out upn's
Now you can open up any of those service, pass into it the requisite information and Invoke Service and it will work for you, for now you will have to trust me till you see it work in the ECT/EL
Host your WCF on an Publicly Available Web Site.. I have a rant here.. I have to do it…
<Rant>
Now I wanted to do this complete exercise using Windows/ SQL Azure and I signed up not more than 3 – 4 weeks ago for a 90 day Trial. 2 weeks ago, I get an email from Microsoft saying that even though I have 68 days left in my trial, I have exceed my limit in usage. Now they want me to pay for it, and all I am trying to do is showcase their service to the world, what a Jip!
</Rant>
So, fortunately the good folks at FPWeb (twitter: @fpweb) where my SharePoint Site is hosted, the way they operate, provides you with all that you really need to either help or if you are a nitwit, hurt you. So, I spun up another Web App under IIS and hosted my WCF there. So, the point here is that I am NOT using Windows Azure Hosted Service for this WCF file, but the concept is still the same, I am using WCF hosted somewhere and SharePoint Online (Office 365) will call my WCF from that location.
So, to host your WCF on IIS, one simple way is to just add a "New Web Site" to our Project Solution, like so..
Once you have added the Web Site (C:\...\CommunityWorkSite as in my example) you need to add the project reference to the WCF Project you created. That inturn, will add the DLL you see in the Web Site Project. Here also, I deleted the Service1.svc file that comes with the Template and added my own, you will have to make a change to that file to set the take away the code behind, and set the location of the assembly to the Dll in the project reference. The file I have now is CommunityWorkService.svc
Next, mod the Web.Config
This basically follows the same rules as the App.Config except as I mentioned, I also added another EndPoint for basicHttpBinding since Im coming across the Internet. Once you have done that, all that is needed to host this in IIS is to go to your IIS Web Site that is publicly accessible, either (1) create a new Web Application or (2) create a new Virtual Directory under an Existing Web App and add this project folder of the Web Site as its location. Once you do that, it is now available.
That is it for Part 2, now you have a working and publicly available WCF.
|
| SharePoint Saturday 2011 in South Florida was a great event organized by Michael Hinckley (Twitter @SharPtContender) Chuck Hughs (Twitter: @ChuckHughes) and David Griffiths. I had a great session on SharePoint BCS thanks to the attendees who asked very engaging questions and very communicative.
As promised here is a link to my slide deck for my Session on Connecting Just About Anything with SharePoint BCS
Also SharePoint Saturdays are also key to connecting and re-connecting with members of the Community. As much as I enjoy speaking and sharing my experiences with everyone, I strongly encourage you to attend your local SharePoint User Groups and start speaking at these events, the more you share, the more you learn.
Cheers, Happy SharePointing! |
|
|
|
|
|
|
|
| There are currently no upcoming events. |  |
|
|
|
|
|