Wednesday, August 25, 2010

Public Sector DPE presents Microsoft Visual Studio 2010 Webcasts

We will offer two types of webcasts on Microsoft Visual Studio 2010, each repeating monthly September through December 2010:
o    Overview of Visual Studio 2010
Visual Studio 2010 is a powerful IDE that ensures quality code. Visual Studio 2010 is packed with new and enhanced features that simplify the entire development process from design to deployment. Customize your workspace with multiple monitor support. Create rich applications for SharePoint and the Web. Target multiple versions of the .NET Framework with the same tool. Eliminate the dreaded "no repro" problem with IntelliTrace. Come find out more...

o    Feature Demonstration of Microsoft Visual Studio
During this webcast, we will provide a demonstration of technical functionalities and feature capabilities of the following:
1.            Test Professional for Tester/Load Testing
2.            Test & Lab management
3.            Team Foundation Server – Version Control, Work Items, Reporting services

REGISTER TODAY using the links below!

Overview of Visual Studio 2010
·         September 16, 2010
·         October 14, 2010
·         November 11, 2010
·         December 9, 2010

Feature Demonstration of Microsoft Visual Studio
·         September 23, 2010
·         October 21, 2010
·         November 18, 2010
·         December 16, 2010

Tuesday, August 24, 2010

SharePoint 2010 Silverlight Client Object Model - How to use

As part of the introduction series, I want to present the advantage of theclient object modelintroduced in SharePoint 2010. There are great advantages with this model as it don't require SharePoint needs to be installed on the client machine. We just need to refer the client dlls which Microsoft SharePoint provides and based on them we will write code to communicate with SharePoint server. In this article we will go through Silverlight Client Object Model. If you want to know the other client object model types go here. ECMAScript and Managed client object models.
To communicate with the SharePoint server in Silverlight context we need to give two client SharePoint DLL references to the silver light project.DLL's Needed: Microsoft.SharePoint.Client.Silverlight.dll and Microsoft.SharePoint.Client.Silverlight.Runtime.dll. They can be found at "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ClientBin".OK, we understand the concept and  we will create a project and implement code for better understanding on how it works.
  1. Open Visual Studio 2010.
  2. File -> New -> Project -> Visual C# -> Silverlight -> Select Silverlight Application project template as shown below.
  3. Give some name to the project. In my example, I have given some meaningful name like "SP2010Silverlight_HelloWorld" and create the project.
  4. Now, you see the below screen.
  5. What this meaning is "Do you want to create an ASP.NET web site and host the XAP file generated to the web site". For our example, it's really not needed. But, there is no problem by using that.
  6. Now next step is getting the SharePoint Silverlight Client Dll's reference to our project. So, for this get the SharePoint dll's to the client machine [Where we created project] and paste the DLL's in some safe location. I copied them to C:\SP2010_ClientDLL\.
  7. Now, go to Visual Studio 2010 project right click on project -> select References and browse to location where client dll's copied and select both dll's and hit ok as shown in below figure.
  8. After you added all references the references folder should look like this.
  9. Now we are ready with all prerequisites and part left is with writing code. I will show you simple code on how to write the code for getting web site title and description using Silverlight Client OM.
  10. Before start coding, we need to add reference to the namespace in page by declaring using keyword as shown below.
    using Microsoft.SharePoint.Client;
  11. This is the code to get data from a SharePoint server, in this example we are retrieving Title and Description of a web site.
XAML code: MainPage.XAML
MainPage.Xaml.cs file code:using System;using System.Collections.Generic;using System.Linq;using System.Net;using System.Windows;using System.Windows.Controls;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Animation;using System.Windows.Shapes;using Microsoft.SharePoint.Client;
namespace SP2010Silverlight_HelloWorld{ public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); }
private ClientContext context = null; private Web web = null; private delegate void UpdateUIMethod();
private void btnLoadSite_Click(object sender, RoutedEventArgs e) { context = ClientContext.Current; web = context.Web; context.Load(web, w => w.Title, w => w.Description, w => w.ServerRelativeUrl); context.ExecuteQueryAsync(OnSiteLoadSuccess, OnSiteLoadFailure); }
private void OnSiteLoadSuccess(object sender, ClientRequestSucceededEventArgs e) { UpdateUIMethod updateUI = LoadSiteData; this.Dispatcher.BeginInvoke(updateUI); } private void OnSiteLoadFailure(object sender, ClientRequestFailedEventArgs e) { MessageBox.Show("Request Failed: " + e.Message + ", Stack Trace:" + e.StackTrace); }
private void LoadSiteData() { canvasLabels.Visibility = System.Windows.Visibility.Visible; label2.Content = web.Title; label4.Content = web.ServerRelativeUrl; label6.Content = web.Description; } }}Place all the code above given in the both files of your project. Note: Remember to change the web url given in the code "http://nb16" to actual SharePoint server url.
Till now, what we have done is, writing and complete code for loading the site data. But, we need to understand the above code.In the above code, there is a callback function used. Which is asynchronous and loads data. But, you may confuse at the line delegate UpdateUIMethod(). I copied the below text from MSDN to better understand about the delegate and why it's needed.
"Because query execution is asynchronous when you use the SharePoint Foundation Silverlight object model, you must pass delegates for callback methods as parameters in theExecuteQueryAsync(ClientRequestSucceededEventHandler, ClientRequestFailedEventHandler) method, similarly to query execution in the ECMAScript object model. However, to run code that makes changes in the user interface (UI) through the Silverlight object model, you must delegate this work to the Dispatcher object of the thread that created the UI by calling BeginInvoke()". So, we should use the delegate to make changes on the UI.
Deploy and Test We have two ways to deploy the XAP file in SharePoint environment.One is, We can use SharePoint default location [\Templates\Layouts\ClientBin] and deploy the file there. Refer this location from the Silverlight web part.Second is, We can use a SharePoint document library and deploy the file there. Refer this document library location file path while adding the silverlight web part. In this post, we will use the default location to deploy and test.
  1. To deploy and test the code in SharePoint 2010 we need to use the SharePoint Silverlight web part [New web part added in this version].
  2. The silverlight web part default location is "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ClientBin". So, all the XAP files should be deployed to this location to use them in the silverlight web part.
  3. To make this process easier, we need to do below.
  4. Right click on Silverlight project -> propertiese -> Build -> change the output path to "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ClientBin" as shown below.
  5. Build the solution and see the XAP generated in the ClientBin location. 
  6. Now, navigate to SharePoint site where you want to see the silverlight data, Edit page.
  7. Add silverlight web part to the page. 
  8. It will prompt you for the XAP file location: Type the url: "/_layouts/ClientBin/SP2010Silverlight_HelloWorld.xap".
  9. Now click on OK and you can see the silverlight web part on the page.
Ooh!!! This is it!!! We are done with development, deployment and testing. Hope this won't create any confusion. If you have any issues please let me know. I am always here to help you out..

Update an item sends an email problem in SharePoint

One major requirement with SharePoint is you set up a workflow which sends a notification mail to list of people when anyone updates the item in the list.

Now this is cool. However the problem here is when actually nothing is modified, then also SharePoint kicks an email and people gets it and wonder what has changed when nothing was actually changed in any of the list items.

To give you a simple scenario, create one list, go to SharePoint designer and create a workflow, attach to the list and select the option which says trigger when item is updated. In workflow send an email to yourself. Now go to the list, create one item. Open the same item, without changing anything, click on ok and there you go. You caught the problem; you still get an email even though you did not change anything.

Well before diving to the solution let me make one thing very clear. What we are looking for is an out of the box solution. We do not want to write any code. Event handler is the best place to write a code and handle this situation, because we can get new value and the old value of the field in the event handler. We can compare all fields with previous and current value and if any of them is modified, then we can send an email else leave it as it is.

But we are talking about the no code solution. So definitely there are some drawbacks to it. But it definitely solves this problem. 

All you need to do is create fields as many fields as you have in the list. If you have seven fields, then you need to create seven more fields in the same list. You can name them anything, but to make it a meaningful, keep the same name of the field, and only append copy to it. Example, we have Title field in the list and new field will be TitleCopy. If Details is the field, then new field will be DetailsCopy.

Soon you will come to know why we are doing this. Well to give you a quick answer, to compare these fields.

After creating Copy fields as we discussed. Follow these steps.

2) Create one workflow from File-New workflow menu.
3) Give a name to the workflow.
4) Attach it to the list.
5) Select trigger this workflow when item is created.
6) We need to define a condition which is always true, you can make condition like if 1 ==1, then in action, Set TitleCopy to ListName:Title, then DetailsCopy to ListName:Details.

Like this set all copy fields to the original fields.

This is your first workflow. Now we also need to create second workflow. I know question has come to your mind that why do we need to create a workflow for assigning this values. We could have created the calculated column and assign the values. Well, I have not done this. Why? You need to find it yourself. Try doing this and you will realize that okay we cannot take approach of calculated columns.

Coming back to the point, create one more workflow, attach it to the same list, and give it a name and select trigger this workflow when item is updated and this time your condition will be like this:

If Title is not equal to ListName:TitleCopy or Details is not equals to ListName:DetailsCopy. In this way, make a condition by combining OR for all fields. If this is true, then send an email in the action.

Add second step in the workflow, check the condition if Title is not equals to ListName:TitleCopy, then in action, set TitleCopy to the ListName:Title.

Add another step in the workflow, check the condition if Details is not equals to ListName:Details, then in action, set DetailsCopy to the ListName:Details.

Add steps for all fields in the list. Now you again must be wondering why we are creating each step for comparing and assigning the values of the field. Well, I would say try it yourself in putting all condition in one step and see the result. You will realize that okay we cannot that this approach. And hence each step must be performed for each individual field.

What we have done here is, first workflow will be triggered when we create the item and assign the values to the copy fields in the list.

Second workflow will be triggered when we modify the list item and in that we have checked the original value which is currently in the Copy fields with the changed fields. If any of them is changed, then only we trigger an email and after triggering we again compare which field is actually changed and we assign the changed value to the Copy field so as to compare it with the next time.

I know question might come that these all copy fields will also be visible at the time of creating, editing and viewing list items. Well you can write a code not to show these copy fields while performing create, edit or viewing the items. Or you can also use jQuery technique to hide them.

I recommend you read Using jQueries in SharePoint for how to hide fields and other stuff.

Now we have solved the problem of sending mail when not updating anything in the list. Mail will be send only when something is actually changed. Try it yourself and do share your thoughts on this.

SharePoint 2010 Meeting Workspaces and Blogs are not MUI enabled

A while ago I wrote about the new multilingual capabilities of SharePoint 2010 based on the Multilingual User Interface (MUI) – see Multilingual User Interface (MUI) in SharePoint 2010 – Part Iand Multilingual User Interface (MUI) in SharePoint 2010 – Part II. But beware – apparently not all site definitions support the MUI.

SharePoint development environments, my guidance

At most conferences or events I get cornered by at least two or three people wanting my opinion on how to best set up their development environments.  Questions like:
  • Should I have all my developers on one shared SharePoint server?
  • Should I virtualize?
  • What spec PCs should I buy our developers?
Here is my guidance in its simplest form, in order of preference:
  1. Locally virtualized instance of SharePoint developer environment for each developer. (either Hyper-V or other, not a debate for this post).
  2. Centrally virtualized instances of dev environment.  Still one per developer.
  3. Locally installed SharePoint developer environment “on the metal” with Windows Server 2008 R2.
  4. Locally installed SharePoint developer environment (on the metal” with Windows 7.
“Why virtualize?”   That way you can snapshot, rollback, have different projects in different VMs etc…  There is nothing less productive than having to spend a morning re-building your development environment if you break it.
“Why Windows 7 last?”  We enabled installation on Windows 7 primary for people who were not allowed or didn’t have access to virtualization technology & secondly people who couldn’t install a server OS on their developer workstation for whatever reason.  I prefer to develop on bits that are as close to production as possible and therefore I would try and develop on Windows Server 2008 R2 first.  Dev on Windows 7 is a great experience, don’t get me wrong, its just I would prefer to use a server OS first. YMMV.
“Why not have everyone on one server?”  Productivity.  Having everyone on one server is nasty for a variety of reasons, including but not limited to:  stomping on each others toes with changes by mistake, limited debugging or only one person at a time, versioning issues and dependency management.  It is just so much more productive to have each dev on their own instance of SharePoint and share code and assets around using a source control and build system like TFS.
“What spec machine should I use?”  My guidance is to buy a quad core proc or greater with 8GB of RAM.  Hard drives are VERY critical you should get the fastest you can buy, 7200 RPM min. SSDs in my experience are the single best way to improved your SharePoint development experience.  I would rather have a fast SSD over 16GB of RAM any day.  We use them in our demo laptops and it makes them scream.   Tip: Run the host OS off your slower spinning disk and run your VMs of the SSD. 
Vesa did a good write up on this topic a while back.  It has much more in depth commentary on the subject:
Information on setting up SharePoint on Windows 7 is available here:
Our Patterns and Practices team recently released an updated set of guidance for SharePoint.  In there is a ton on building apps for SharePoint.  Check it out.

Friday, August 6, 2010

Configuring salience intend in SharePoint 2010

So I prepare break my advance into this and it drives me nuts. So I am exploit to try to pose together few quick nuggets. I acquire gotten this to successfully output some a dozen nowadays so I bang hopefully seen all of the insanity. I bed also worked with Character Klindt to compile several of these notes.

The front one is for morality sakes see this TechNet article. share paint full details, If you translate it slow and do everything it says you can do rattling slight misconduct. But no one wants to construe it so here are my notes.

The farm accounting HAS TO BE A Localized ADMINISTRATOR. I am worthless but there is no way around this alter now so depart disagreeable to abstain it. Having a job figuring out what calculate is your farm account? I can helpfulness with that.

Midmost Admin &get; System Settings &get; Deal services on server .Manuscript mastered and attain the Mortal Strikingness Synchronization Company and occlusive Start You instrument see an record recorded. This is the calculate that staleness be a local executive story

If you are adding this invoice to the localized administrators group for the opening time mitt now you should resuscitate your server after you finish. If you don't you testament get whatever difficult DCOM errors that gift not go off until you are a topical admin and revive. The farm invoice has to be able to logon as a help. By neglect a anesthetic head can but upright in sufferer you soul locked kill your computer spare impermeable this might move up as it did for Character the additional day.

This unvarying farm accounting has to possess the Reduplicate Directory Changes permission in progressive directory. This is also not facultative. I also ran into an supplying when the set operable stage in live directory was solace 2000 but I cannot see the notes on that. Something around this Flex Directory Changes not boringness workable.

An crotchet I don't really interpret but screw seen rest. In one containerful I had to log onto the computer as the farm admin accounting one instant before I was fit to get the pair to sign. Most of the case this is the sufferer but once it was. Very odd. This journal communicating had the one printing.
If you get the personnel started and then try to handle the individual strikingness personnel travail and get few slaphappy mistake pop up you vindicatory pauperism to do an IISRESET.A duo of MSDN facility posts and new personality that I looked at along the way:

Send 1
Send 2
Journal writer

Diary install from Twerp

If you are feat goofy DCOM issues inactivity out this blog collection for getting rid of them. There are two View Identicalness Trainer (FIM) services that get installed as Windows services by SharePoint. If you are troubleshooting salience imports and see FIM errors they are corresponding to your difficulty. Don't try to cheat these services manually.

If you have a multi-server farm you exclusive necessary to start the couple on the server you necessary it flowing on, not all of them. The quick steps Make trustworthy your farm informing has all those super permissions, realm admin power be easiest ;

If you had to update your farm record permissions resuscitate now and spend yourself the aching Commence the Mortal Strikingness synchronizing assist, yes it gift get 5 to 10 transactions to play the couple Do an is reset. Go to control your mortal profile union coating. Plosive on Configure Synchronisation Connections
Create a new link to your environment. Eat in all the info and then select what OUs you poverty to significance and flick OK. From the succeed profile union occlude dawn on Sign Salience Synchronisation
Mark your fingers and be diligent. It takes a patch.

SharePoint 2010 How ERM improves

One of the trends of the industry news is the idea to place the data management rather than a central repository of documents that require a routing service. In this method, the documents remain in its current location, and they are classified as business records. This will allow the document to obtain the necessary security, storage and disposal without ever having to be transported to a centralized location. This saves on IT resources and more time in the fall may eDiscovery. New in SharePoint 2010 is the adoption of this technique will certainly be a good choice for many organizations to consider RM.