in

Corey Roth and Friends Blogs

Group site for developer blogs dealing with (usually) Ionic, .NET, SharePoint, Office 365, Mobile Development, and other Microsoft products, as well as some discussion of general programming related concepts.

Kyle Kelin on .Net

  • The Factors that Influence Adoption in Corporate Applications

    As an Account Manager for an IT consulting firm, my customers rely on my firm’s resources and myself to provide advice and guidance on some of their most difficult challenges. A development manager might need to improve his or her team’s build process or a CMO might need help leveraging mobile technologies to promote his or her brand. While the challenges vary by title and company, one challenge that has been reoccurring lately is how to increase user adoption and specifically user adoption for employees for certain applications inside their enterprise.

    Why is user adoption so important to these customers? The answer is pretty simple. These customers are investing a large amount of money on these application deployments and adoption is a key measurement of success and ROI.

    Why not just mandate them? There are three reasons executives avoid mandating systems such as SharePoint which are:

    1. Employee unrest

    2. Technologically difficult

    3. Increased cost

    Employee unrest is a bit tongue-and-check but many IT executives might not want to spend the political capital necessary to force users to use the new system. Also they may not be 100% convinced the system will meet everyone’s needs. Secondly the technology might be very challenging to prevent users from certain behaviors. For example suppose you wanted users to stop attaching documents in e-mail and instead store those in your ECM solution and link to them. How would you do that? Well the actual preventive measure would be easy just set the attachment size limit in Exchange to 1KB. However, this will present a problem when the user needs to e-mail the document to an external party who doesn’t have access. What if it is an attachment type that your ECM solution does not support? You can see there are many exceptions to just this one behavior. Lastly, there is the technology and training cost associated with a mandatory rollout. Optional rollouts are much easier in terms of costs and planning; just ask any ERP consultant.

    Once we’ve understood that adoption is important and we are going to use it to measure the success of our project, the next step is to understand what factors influence adoption. There are eight factors that influence adoption. Some of these are factors you can influence with your project’s adoption strategy while others are personal factors that can vary by employee. These factors you should be aware of but will not be able to influence directly.

    The factors in order are:

    1. User Involvement

    2. User experience

    3. Perceived Value

    4. Communications Quality

    5. Training Quality

    6. Peer Influence (needs to be communicated)

    7. Leadership and organization pressure (How involved are they?)

    8. Technology comfort and tolerance for change

    User Involvement

    This is the number one factor in the adoption of a new system so you should pay close attention to it. The more your users feel involved in the designing of the system and the decision making process the more positive they will perceive the system and adopt it. In fact those with a high degree of buy-in will influence other employees to use the system creating a bit of a grass roots campaign.

    The first approach we take to involving users is at the beginning of the requirements gathering process by creating and sending a survey. Send this to as many users as feasible, but be sure the people you ask are strategic. Typically, you only have a fixed amount of time so you have to make sure that every person you involve counts. The next step is user interviews. Since you cannot involve everyone, I usually recommend adding the most thorough responses to the round of user interviews. Finally be sure you communicate progress back to the survey respondents and interviewees so they know that their input was incorporated into the system.

    User involvement does not stop once the project is deployed. Be sure to solicit feedback after launch. I also recommend having a feedback link on every page of the site.

    User Experience

    Do not mistake User Experience for branding. While branding is an important part, UX focuses on all aspects of how the users will experience and interact with the system. This also includes the functionality of the system. Over the past several years, I have found many small UX improvements to established applications (e.g. SharePoint, Documentum, Dynamics CRM) that save the user time and make the system easier to use. An example of these improvements are pre-populating fields based on the user or previous selection. The investment of these improvements is small and save the organization training cost as well as improve the user experience thus improving user adoption.

    Perceived Value

    The Perceived Value factor is actually perceived value compared to perceived cost. This is how humans not just employees make most decisions. If I take the time (cost) to learn and do this, will it make my job faster / easier / more rewarding (benefit)? It is important to note that I said perceived value and benefit. This is what the employee thinks not what you think. You might know if the user takes the time to learn the system it will improve their productivity. However the employee has to truly believe the benefit in order to change their behavior.

    Communication and Promotion Quality

    While communications and promotion are related, I’m going valuable to address them separately. Communication requires a sender, a message, and an intended recipient and is defined as the action of distributing information. How you announce the system, prepare users for it and keep them updated on the progress is communication and is vital to your adoption strategy. I recommend that most communications should focus on the features of the system and how these features will benefit the user. Keep in mind most users only have the ability to process 1-3 new features at a time so if your system has lots of discoverable features (Office, SharePoint) it is a good idea to send out tips and tricks as part of your communications plan.

    While promotion does communicate, an idea or ideas about the application, it does it with a bit more flare. The message should be direct and simple and again focus on what is in it for Joe User. The amount of flare and pizzazz will vary by organization and industry. Here are some examples of promotional activities:

    - Have a launch event that includes some prizes.

    - Commercials. You can do these fairly inexpensively.

    - T-shirts, stress balls, pens, or other promotional material

    - Show screencasts or videos in high foot traffic locations

    Training Quality

    In my experience this is the most ignored adoption factor on the list. I see far too often system projects with a million dollar budget yet have a training spend of $10,000. Some symptoms of a low training budget might be lower user satisfaction in the system or a higher than anticipated number of support calls.

    Your project should have a training plan and at the minimum it should state:

    - Who your users are and organize them into groups

    - What details each group needs

    - What the appropriate training medium is for each group

    More than likely you will want to have more cost-effective training for end-users. Webinars or Computer based training programs are cheaper than in person training for a large number of users. Another strategy I have seen effective is creating short videos with specific content that explains how to do something. Embed these videos throughout the system. For example you could place a video that explains how to search for a document next to the search bar in your system.

    One training strategy I’ve found effective is “train the trainer”. If the target user base is large and geographically dispersed you could train certain power users in each geographical area. These power users could therefore train end-users without your involvement. The benefit is the trainer is closer to the user and the user can use them as a resource after the training has completed. Just be sure to sample the training classes from time to time to ensure the material is being delivered how you intended.

    Besides cost concerns, another reason for lack of training is employee time. The key is being sure the training is effective and you convince the doubters that this will save more time in the long run. I usually recommend doing this in the communication plan. The communication plan should tell the users how the system will benefit them and also the benefits of the training.

    I often get asked should the training be mandatory or optional. I’ve seen companies make granting access to the system dependent on employees taking training classes or online courses. I disagree with this for the simple fact that if you are deploying an off the shelf product, a certain number of employees will have already had exposure to it at past companies. Besides, if you do a good job addressing the other adoption factors, employees will be lined up to take training classes.

    Training is one aspect that differs between wide-spread consumer facing applications and enterprise applications. Training on consumer applications is usually not possible because of the number of users that would need to be trained. I do not think that Facebook will be creating a training course on how to post to a status update anytime soon. Although with everything people post maybe they should come out with a “What not to Post to Facebook” course.

    Peer Influence

    It is pretty obvious that users influence other users. How do we harness that power for our system deployment to increase the user adoption? The level of peer influence is affected by organizational culture, industry, and employee proximity to one another. Many of these are beyond the project team’s control but there are two things that can be done, find the influencers and nurturer them. Find the influencers in training classes, during requirements gathering and through employee surveys. Doesn’t matter where just find them. Once you have your list, cater to them by providing additional support and training. You should also update them on how their suggestions are being implemented.

    It is important to dispel the misconception that these influencers are in official mentoring roles or leadership positions. An Influencer can be Betty at reception because she has been in the department 20 years and knows where to find any document or the guy in accounting that can do anything in Excel. As part of your adoption plan spend the time to identify the true influencers for your system and do not just rely on the organizational chart.

    Leadership and Organization Pressures

    Leadership and organization pressure is similar to peer influence but originates from management and the executive level. This factor is interesting, because in my experience, leadership cannot influence user adoption. However, the lack of leadership support can negatively impact it. Take for example if you have a Launch Event and the highest level employee in the office skips it to catch up on email. Employees will infer from their action that the system is not a priority and they will consciously or subconsciously deprioritize the tasks required to adopt the new system. So be sure during your system rollout that you have senior leadership buy-in and involvement.

    Comfort with technology and tolerance for change

    Technology comfort and tolerance for change are two personal factors that affect adoption. However, your project team will not be able to directly influence or control these. No matter how great the system, the training, and communications there will be a small percentage of your work force that is technophobic and resistant to change. The good news is once you’ve got those in the larger group using the system the technophobes will come around.

    If you focus on these eight factors at the start of your project, during your project, and after deployment I can promise you the system will be used by more users than without these factors. Be sure prior to rollout you have a baseline of expected user adoption. This can be from the previous systems or if that data is not available other unrelated systems. After the launch of the system you should measure the usage of the system. Comparison of these two numbers will help justify the cost of the project and possibly even your salary.

  • Check Glimpse Out

    Two good friends of mine recently made a big splash at Mix this year and I thought I would mention them here. Nik (@nikmd23) and Anthony (@anthony_vdh) both work for Infusion decided to start a project in their own time that is a debugging tool for ASP.NET MVC projects which shows you what is executed on the server during a request and response. The really cool part is they unveiled it at MIX during an open source showcase and Scott Hanselman and Phil Haack saw it and loved it. Nik and Anthony got to demo it to Phil and Scott personally and Scott then worked it into his talk that day. They are now up to 2,000 downloads and counting. The buzz in the community for them has been fantastic.

    Check out Glimpse here:
    http://www.getglimpse.com/

    Also see Scott’s post about it here which has more details then what I had time to write here:
    http://www.hanselman.com/blog/NuGetPackageOfTheWeek5DebuggingASPNETMVCApplicationsWithGlimpse.aspx

    So happy for the attention these guys are getting. It couldn’t happen to two nicer, more passionate developers.

  • Code and Slides from SQL Saturday in Baton Rouge

  • Getting Started with Unit Testing SharePoint

    Last week at the Dallas Techfest I spoke about using TypeMock to Unit Test your SharePoint code. I wanted to follow that up with a few blog posts about mocking, SharePoint, and TypeMock. This first post will just be a quick intro on how to get setup.

    Before I discuss how to get started unit testing SharePoint code I will take a step back and ask if it is even worth the effort . The answer is it depends on the size and complexity of the SharePoint project. I would say unit testing SharePoint is for large customization projects of SharePoint where you have numerous web parts, event receivers, workflows and custom business classes. These larger development projects should be treated like any other .NET project and be unit tested in the same way.

    Adding SharePoint References

    I’m going to assume that you haven’t started a SharePoint project yet. If you have then you should skip to step 3. One of the first things you need to do is add a reference to the SharePoint dll. Depending on what classes in the object model you are referencing will mean you have to add additional dlls. Here you would also configure your build process and how your wsp will get generated. I recommend automated this with a tool like wsp builder. Of course with SP2010 this gets a lot easier. Next you will also want to create a unit test project that will contain your tests for your entire code base.

    http://geekswithblogs.net/evgenyblog/archive/2008/01/27/118966.aspx

     

    Installing and Adding TypeMock References

    Next we need to download TypeMock isolator for .NET. You don’t need a separate install for SharePoint. http://site.typemock.com/isolator-download?id=1

    *Must have TypeMock Isolator for SharePoint

    Then add a reference to TypeMock dll from your unti testing project

     

    Examining Our Method Under Test

    Once we start to create some unit tests we are going to realize we need some help. The first challenge is we don’t want to test the SharePoint code that our business logic is calling. One reason is because this would become and integration test and make our test slow since they would have to go out to SharePoint and execute the code that we had written. The other reason is I might want an environment where not all my developers are running a SharePoint server. They could then write code, unit test it, and deploy it to some type of integration environment.

    Let’s take an example of this method:

     public bool UpdateCustomerSPListItem(string firstName, string ID)
            {

                SPListItem item;
                using (SPSite site = new SPSite("http://localhost"))
                {
                    SPWeb spWeb = site.OpenWeb();
                    var customerSPList = spWeb.Lists["Customers"];
                    SPQuery query = new SPQuery
                                            {
                                                Query = ("<Where><Eq><FieldRef Name=\"ID\"/><Value Type=\"Text\">" +
                                                         ID + "</Value></Eq></Where>"),
                                                ViewAttributes = "Scope='Recursive'"
                                            };

                    var itemCollection = customerSPList.GetItems(query);

                    if (itemCollection.Count == 0)
                      throw new NoSPListItemsFound();

                    item = itemCollection[0];

                    //test parameter
                    if (string.IsNullOrEmpty(firstName))
                        throw new ArgumentNullException("First Name can't be null or empty");


                    item["FirstName"] = firstName;
                    item.Update();              
                }
                return true;
            }

    The method UpdateCustomerSPListItem is a pretty simple method that takes a first name parameter and updates the custom list item with that id (second parameter). Now this method is pretty simple but imagine that it contained more business rules and logic. The only rule we have right now is first name cannot be null or empty. Notice that this method has several dependencies., SPListItem, SPWeb, SPQuery etc… Those all need to be stubbed out in order to stub or fake this class. We would need to create a FakeSPListItem class that has an update method, a FakeSPWeb class that has a constructor, each of these returning fake values.

    Take a few minutes and go through the rest of the dependencies in your head, as you can see this would be a lot of work. The great thing about mocking frameworks is they do this creating of these fake classes for us. Now this is great but most frameworks need an interface to create the fake object. Not only do SharePoint classes not have interfaces but many of the classes are sealed or have private constructors. This is where TypeMock comes in. As far as I know it is the only framework that can mock these types of classes.

    We can now write a test method that will test UpdateCustomerSPListItem without having to update an item on a SharePoint server nor do we have to stub out ever class in the SharePoint namespace.

     

    Let’s Write Our First Method

    First step would be to create a test method and add a recording using statement. Note I’m using the BDD syntax of naming test methods.

            
            [TestMethod, VerifyMocks]
            public void Update_Customer_ListItem_When_Given_ID_AND_Name()
            {
                using (RecordExpectations rec = RecorderManager.StartRecording())
                {
                              
                }


            }

     

    Next we need to plug in the steps of our UpdateCustomerSPListItem method that we want to test. Just like in the method under test we create a SPSIte, SPWeb, and SPListObjects. We then write a CAML query to get the item we want to update. The difference in our test is we are not interested in what the query is so we can just pass in a SPQuery object without a value.

            
            SPSite mockSite = new SPSite("");
            SPWeb web = RecorderManager.CreateMockedObject<SPWeb>();
            rec.ExpectAndReturn(mockSite.OpenWeb(), web);

            SPList mockList = RecorderManager.CreateMockedObject<SPList>();
            rec.ExpectAndReturn(web.Lists[""], mockList);
            SPQuery query = new SPQuery();

            SPListItemCollection listItemCollection = RecorderManager.CreateMockedObject<SPListItemCollection>();
            rec.ExpectAndReturn(mockList.GetItems(query), listItemCollection);

            SPItem item = RecorderManager.CreateMockedObject<SPListItem>();
            item = listItemCollection[0];
            item["FirstName"] = "canbeanything";
            item.Update();
      

    Next we need to call our method under test and add an assert statement like so:

          
            var result = classUnderTest.UpdateCustomerSPListItem("Kyle", "1");
            Assert.IsTrue(result);
          

    Now this does test that the method returns the correct value but we also want to make sure that the method executes as we expected. For example making sure we call item.Update. In my opinion this is the real value of using a mocking framework. In order to verify expectations we add the VerifyMocks attribute.

    The entire test method looks like this:

            [TestMethod, VerifyMocks]
            public void Update_Customer_ListItem_When_Given_ID_AND_Name()
            {
                using (RecordExpectations rec = RecorderManager.StartRecording())
                {
                    SPSite mockSite = new SPSite("");
                    SPWeb web = RecorderManager.CreateMockedObject<SPWeb>();
                    rec.ExpectAndReturn(mockSite.OpenWeb(), web);

                    SPList mockList = RecorderManager.CreateMockedObject<SPList>();
                    rec.ExpectAndReturn(web.Lists[""], mockList);
                    SPQuery query = new SPQuery();

                    SPListItemCollection listItemCollection = RecorderManager.CreateMockedObject<SPListItemCollection>();
                    rec.ExpectAndReturn(mockList.GetItems(query), listItemCollection);

                    SPItem item = RecorderManager.CreateMockedObject<SPListItem>();
                    item = listItemCollection[0];
                    item["FirstName"] = "canbeanything";
                    item.Update();
                }

                var result = classUnderTest.UpdateCustomerSPListItem("Kyle", "1");
                Assert.IsTrue(result);
            }

    There you go your first unit test for SharePoint code using TypeMock. My plan is to go into more detail of how to mock out other SharePoint objects like Event Receivers, Web Parts, and Workflows.

  • Slides and Code from my talk at Dallas Techfest

  • Speaking at Dallas TechFest

    Speaking tomorrow at 9am (July 29th) over unit testing SharePoint with TypeMock. I’m a little scared seeing that I’m the only SharePoint session for the entire day. :) Here is more info about the event:

    http://dallastechfest.com/Default.aspx

  • Slides and Code from Houston SharePoint Saturday

  • Why Not Make Your SharePoint 2010 Menus Sortable?

    One big improvement in SP2010 is in the rendered markup. You will see fewer tables and more lists and div elements.When I saw this I immediately thought of what this would allow with jQuery. The Ribbon control and menus in SP2010 are rendered as unordered lists. This allows us to apply interactions to them from the jQuery UI framework. In this post I am going to walk you through an example. In the example we are going to apply the sortable interaction to the SharePoint menu. After deploying our Web Part , the user can then reorder the menu items. In the screen shots below I am moving the Browse menu item to the right of the Page menu item. Now in this example I don’t save the result so the page refresh would reset the users sorting but you could easily write some JavaScript code that saved the order to a SharePoint list.

    image

    image

    image

    Step 1 – Create a new Visual Web Part project in VS2010. There are already many articles on this subject so I will allow you to just go ahead and Google this if you need to.

    Step 2 – Download and reference jQuery and JQuery UI.
      There are a number of ways to do this. I chose to simply download the files and drop them in the layouts folder of the 14 hive. You can also directly link to them on Google. Here are my references:

    <script type="text/javascript" src="_layouts/jquery.min.js"></script>
    <script type="text/javascript" src="_layouts/ui.core.js"></script>
    <script type="text/javascript" src="_layouts/ui.sortable.js"></script>

    Step 3 – The rest of the code in the Visual WebPart

    <script type="text/javascript">
        $(document).ready(function () {
            $(".ms-cui-tts").sortable(); ;

        });
    </script>

    This is all the code that is required! The class of the UL element that wraps the menu we are trying to make sortable is ms-cui-tts. To keep this example simple I used a Visual Web Part but it would be better to add the above JavaScript block to the master page so that all pages had the same functionality.

  • Add Dragging Functionality to SharePoint 2010 in Five Minutes

    In this post I am going to outline a quick example of using the jQuery UI framework to enable elements on your SharePoint page to be dragged around. This would probably work in SP 2007 too but I have some plans to apply this to the Ribbon control in the near future.

    What we are building:

    image

    A Visual Web Part (Web Part + User control) that will contain a div element with a blue border and “Drag me around” text. The blue box can be dragged around the page by the user. Simple enough.

    Step 1 – Create a new Visual Web Part project in VS2010. There are already many articles on this subject so I will allow you to just go ahead and Google this if you need to.

    Step 2 – Download and reference jQuery and JQuery UI.
      There are a number of ways to do this. I chose to simply download the files and drop them in the layouts folder of the 14 hive. You can also directly link to them on Google. Here are my references:

    <script type="text/javascript" src="_layouts/jquery.min.js"></script>
    <script type="text/javascript" src="_layouts/ui.core.js"></script>
    <script type="text/javascript" src="_layouts/ui.draggable.js"></script>

    Step 3 – The rest of the code in the Visual WebPart
      To finish off the Visual WebPart (remember that is just a user control) add this code:

    <script type="text/javascript">
        $(document).ready(function () {
            $("#draggable").draggable();

        });
    </script>

    <div class="demo">
        <div id="draggable" style="width: 150px; height: 150px; padding: 0.5em; border:1px solid blue">
            <p>Drag me around</p>
        </div>
    </div>

    The JavaScript function just attaches the draggable function to any elements with an id equal to “draggable” when the HTML document finishes loading. The html code is the element that we are going to allow the user to drag plus some styling.

    Step 4 – Deploy
      Just right click on the solution and select Deploy. Then create a page and add your new Web Part to the page.

    A few final comments about this. The way I deployed the js files is bad. And you would never want to do that in a real-world scenario. Instead you would want to add those as part of the feature and wsp. And you can also create a specific jQuery UI JavaScript file that contains all the features you want in one file. Here I just copied the draggable JavaScript file to the layouts folder. Also don’t forgot to explore the jQuery UI for cool options besides the plan drag example I am using here.

  • PowerShell: My First Look

    Even before the details of SharePoint 2010 were announced I’ve been wanting to learn PowerShell. Of course now that SP2010 is relying on PowerShell almost entirely I have extra motivation to learn the tool. I thought what I would do in this post is document step by step what I did to get familiar with the tool. Readers new to PS can follow along to help them get started.

    I first went to this link and downloaded the PowerShell cheat sheet here . This way as I learn commands I don’t really have to remember them.

    After fixing some printer issues I read this article from James Kovacs here

    The paragraph below gives you a basis for how PowerShell commands are structured:

    Believe it or not, you probably already know a fair amount of PowerShell. Many of the commands you’re familiar with in cmd.exe work in PowerShell. (More surprisingly, many of the common commands you know from bash, tcsh, or other Unix shells also work!) The command line arguments are often different, but the basic familiar commands are there. So try out dir, cd, copy, del, move, pushd, popd, … (If you’re a old Unix hacker, you can try out ls, man, kill, pwd, ps, lp, cp, … Unfortunately there is no grep equivalent built in, which is terribly unfortunate.) All of these commands are actually aliases to PowerShell commands, which are named by VERB-NOUN, where NOUN is singular. For example to get a list of running processes, you run Get-Process, which is aliased to “ps”.

    PowerShell is very conducive to experimentation. You can always find out more about a command or alias typing “Get-Help [CmdName|Alias]” or simply “help [CmdName|Alias]” since help is an alias for Get-Help. (N.B. PowerShell is case insensitive.) You can also look for commands by typing part of the command and pressing tab repeatedly. For example, if you want to find all set- commands, type “set-[TAB][TAB]…” to display Set-Acl, Set-Alias, etc. You can also look for commands using wildcards. Type “*-Acl[TAB][TAB]…” displays Get-Acl and Set-Acl.

    After that I watched Hanselman’s PowerShell tutorial on DnrTV. After that I immediately installed PowerTab. This tool adds intellisense to PS which is a huge help. Best part is it is free.

    Since my main reason for learning PowerShell was to use it with SharePoint the final step was to read this article by Corey Roth which shows you how to load up the SharePoint PowerShell commands.

  • My First Attempt At Using the SharePoint 2010 Client OM from WPF

    I took a crack at building a WPF application that interacts with a SharePoint 2010 site. I’m going to skim over how to create a WPF application since you can find that in other blog posts. After creating your WPF app you need to add two references: Microsoft.SharePoint.Client and Microsoft.SharePoint.Client.Runtime. Both assemblies are in the 14 hive of any server running SharePoint 2010.

    Next add two using statements in the code behind class of the main window:

    using Microsoft.SharePoint.Client;
    using SP = Microsoft.SharePoint.Client;

    Then in the constructor of the MainWindow (still in the code behind class) add the follow lines of code like so:

            ClientContext context;

            IEnumerable<SP.List> listsCollection;

     

            public MainWindow()

            {

                InitializeComponent();

     

                try

                {

                    context = new ClientContext("http://sp2010/");

                    Web site = context.Web;

                    context.Load(site, osite => osite.Title);

                    context.ExecuteQuery();

     

                    Title = site.Title;

                    ListCollection lists = site.Lists;

                    listsCollection = context.LoadQuery(lists.Include(l => l.Title, l => l.Id));

                    context.ExecuteQuery();

     

                    ListBox1.ItemsSource = listsCollection;

                    ListBox1.DisplayMemberPath = "Title";

     

                }

     

    This code assumes that there is a ListBox named ListBox1 in your XAML of MainWindow. So you should go and create that now. The first thing the code snippet does is create a ClientContext object based on the URL to our SP site. The next line is using the Load method of the context object. The lamda expression being passed in as the second parameter allows us to only load that property. So we are getting the site but only loading the title property. It is also important to note that the Load method doesn’t execute until we call the ExecuteQuery. Both of these methods were written this way to improve performance by cutting down on either database calls or payload sizes.

    The next 3 lines follow a similar pattern of setup then execute. This code uses the site name to retrieve all the lists for that site. Again we only the title and id to reduce the amount of data coming from the server. And again we call ExecuteQuery, failing to do so would result in listsCollection being null.

    The final two lines simple bind our list collection to the ListBox so we can display the titles of the lists.

    The next thing I wanted to do was to try out updating a list. So add a textbox and button to your window. Add an event handler to the button like so:

     

     private void button1_Click(object sender, RoutedEventArgs e)

            {

                var list = (SP.List)ListBox1.SelectedItem;

                list.Title = textBox1.Text;

                list.Update();

     

                context.ExecuteQuery();

            }

     

    Again same pattern of setup and then execute. I grab the item that is selected in the ListBox and cast it. Be sure you are casting it to the client List object and not the SPList object. As our requirements grow we could simply set more properties or add columns just like we did in SharePoint 2007. Then we call ExecuteQuery to execute the changes. Note: do not forgot to call list.Update before the ExecuteQuery. If you don’t the code will execute without error but the list title would not get updated.

    Side Note:

    This is my first blog post where I used Visual Studio 2010. In doing so I needed to install CopyAsHtml so I could paste my code in this post properly. I had forgotten about a previous post that Corey Roth had written about getting this add-in to work in VS 2010. Click Here.

  • Some other UI Hooks in SharePoint 2010

    In my last post I wrote about the Ribbon Control. In this post I’m going to review three new UI features in SP 2010 that SharePoint itself uses but you as a developer can leverage in your own applications.

    Status Bar

    image

    The status bar is for persistent information like page status or version. It will show just below the ribbon control and you can select 4 different background colors. The javascript api is pretty simple:

     

    SP.UI.Notify.addNotification(strHtml, bSticky, tooltip, onclickHandler)

    SP.UI.Notify.removeNotification(id)

     

    Notification Bar

     image

    The Notification bar is less intrusive then the status bar and used for more transient information. By default each message remains on the screen for five minutes. Let’s look at some javascript to add and remove these notifications:

     

    SP.UI.Status.addStatus(strTitle, strHtml, atBeginning)

    SP.UI.Status.updateStatus(sid, strHtml)

    SP.UI.Status.removeStatus(sid)

    SP.UI.Status.removeAllStatus(hide)

    SP.UI.Status.setStatusPriColor(sid, strColor)

     

     

    Dialog Platform

    One of the first things you will notice about SP 2010 is the effort the development team has put forth to reduce the number of page refreshes. One way to do that is to make use of Modal Dialog boxes. Just create a new list item and you will see exactly what I am talking about. You can make use of this Modal Framework using the javascript API. You will pass in another webpage or a DOM element. For example:

     

    function myCallback(dialogResult, returnValue) {alert(“Hello World!”);}

    var options = {url: “/_layouts/somepage.aspx”, width: 500, dialogReturnValueCallback:myCallback};

    SP.UI.ModalDialog.showModalDialog(options);

     

     

    I obtained the information in this post from Elisabeth Olson’s UI Presentation at the SharePoint 2009 Conference.

  • Customizing the Ribbon Control in SharePoint 2010

    image

    The first time I saw the html source of a page with the Ribbon control my mouth started to water thinking about all the possibilities. First the ribbon is rendered as an html list. No tables. So tweaking the styling of this is super easy. Also I have implemented some drag and drop functionality using jQuery and jQuery UI and the most common html I worked with was a html list. Most of the things going through my mind right now are just cool visual effects in that area but having that much control is going to allow for some pretty cool functionality with the ribbon.

     

    Besides jQuery and Javascript there is a built-in way to add elements to the Ribbon control. You simply create a feature and a RibbonButton.xml file. Since I haven’t had too much time with the Beta take a look at this post for more details:

    http://blogs.msdn.com/jfrost/archive/2009/11/06/adding-custom-button-to-the-sharepoint-2010-ribbon.aspx

     

    I obtained the information in this post from Elisabeth Olson’s UI Presentation at the SharePoint 2009 Conference.

  • Speaking at TNUG tonight

    I’m giving a quick presentation over Telerik at the Tulsa .NET User’s Group meeting tonight. I go on at 6:45pm, pizza starts at 6pm.

     

    TCC (Tulsa Community College) Northeast Campus
    3727 East Apache
    Tulsa, OK 74115
    918-594-8000
    Campus Map | Live | Yahoo | Google | MapQuest
    We meet in the Main Academic/Administration Building, Seminar Center, Room 109.

  • Why You Should Care About SharePoint 2010

    I spent last week at the SharePoint 2009 Conference learning about the new features in SharePoint 2010. I must say that I am pretty impressed. The product has dramatically improved especially for developers. There are tons of post already out there about specific features but I wouldn’t to write a brief post highlighting what I think the most important features are. Of course depending on what you used SharePoint 2007 for, what is most important is going to very. Since I am trying to keep this post brief I encourage you to search for each topic to gain more insight and details into each one. Note: these items aren’t in any particular order.

    1. Data Access

    There are now four ways to access data (3 new ones):

    · Server Object Model – same as in SP 2007

    · Client Object Model – this OM is used when your code isn’t running on the server. Examples Javascript, Silverlight, or a WPF app.

    · REST – the lists are exposed as rest services

    · Linq to SharePoint – you can use SPMetal to generate classes based on lists and then use linq queries on them. I have been waiting for this for a long time.

    In 2007 to get SharePoint data into SL, WPF or Surface you had to write your own WCF service that used the SharePoint OM or ASMX. I imagine we are going to see some really cool ways to expose SharePoint data now that this is simpler.

    http://msdn.microsoft.com/en-us/sharepoint/ee513151.aspx

    http://msdn.microsoft.com/en-us/sharepoint/ee513152.aspx

     

    2. Deployment is so much easier

    This one feature is going to make SP developers’ lives a lot less painful. You now have F5 deployment to your local environment from inside Visual Studio. But as easy as it is, it is also very open and extensible. Plus you can run SharePoint on Windows 7 64 bit.

    http://www.binarywave.com/blogs/eshupps/Presentations/From%20.NET%20to%20SharePoint%20-%20Introduction%20to%20SharePoint%20Programming%20for%20.NET%20Developers%20%5BSEF2008%5D.zip

     

    3. New Business Connectivity Services (formerly known as BDC)

    BDC was read only so I could view data from a database in SharePoint but couldn’t edit it. So now we can easily pull in SQL data expose it as lists and users get all the sorting, filtering and editing capabilities of a list. This also ties nicely into Office

    http://msdn.microsoft.com/sharepoint/ee513153.aspx

     

    4. Relationships between lists

    Another feature that I have been waiting for. If you have a Customer and Orders list, you can add a lookup column on Order that points to Customers. The really cool thing is you can display as many columns from Customer as you would like. Also you can enforce referential integrity.

     

    5. Validation

    You can set validation rules using an Excel-like formula when you create columns. You no longer have to write event-receivers for this.

     

    6. New UI improvements

    They have cut out lots of page refreshes to make it faster to create and edit documents and pages. Safari and Firefox are 100% supported! I did a view source on the page and there are very little tables. Also in edit mode there is a ribbon at the top of the page which allows users quick access to those buttons needed to edit the page. The ribbon control is easily customizable. I added a new button in lab in about 10 minutes.

    http://msdn.microsoft.com/sharepoint/ee513157.aspx

     

    7. Managed Metadata Services

    Completely revamped approach for meta data.  There is now a central repository that will allow you to manage your taxonomies in a much more centralized way. There is a new column type called Managed Metadata which is tied to a term set. This is similar to a choice column except it is centrally managed. Let me give an example. You could have a term set called Months and the terms would be January, February etc… Months never really change but the power comes with terms sets that do and now all those columns get automatically updated. Also another cool feature is a use can type in January, Jan, or 1 and all those get stored as January.

     

    8. SharePoint Designer

    SharePoint Designer is really improved and you can export most of your work as a wsp which means those changes are portable. Huge improvement from 2007. 

     

    9. SharePoint Workspace

    There is now a desktop application called SharePoint Workspace (formerly Groove) that allows users to sync with SharePoint and then work offline. Then sync those changes back the next time they go online. I haven’t used it but if it works as promised, users are going to love this.

More Posts Next page »
2019.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems