in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

OBA, SharePoint and Aghy [MVP]

May 2008 - Posts

  • Case Study: Insurance Contract Management - Part I.

    We have an insurance customer, who required a contracr repository. WSS 3.0 fits on their base requirements, but they had some special needs as well: First of all, at the end of contracts' lifecycle, after signing them, we have to save several attachments, for example scanned copies or some appendixes. In one word, every contracts contain a main document and some attached documents, so we need document libraries with ability to attach files to documents. The second special need is a custom field, which manages the contract elements' permissions.

    Document library with ability to attach files

    In WSS 3.0 we don't have any out-of-the-box feature to manage attachments in document libraries, so we have a little trick. Our steps were the followings:

    • Create the base document library, which stores the contracts.
    • Create a secondary document library, which will store the attachments. This library have to contain a lookup column to the base document library - we store here a reference to the bace contract for every attachment.
    • Insert special commands to base library's element menu with a little javascript added to a Content Editor webpart on AllItems.aspx: one for Add new attachment, and the other one for View attachments:
      <script language="javascript">
      // Add a custom menu items into the menu
      function Custom_AddDocLibMenuItems(m, ctx)
      {
      var strDisplayText = "Add new Attachment";
      var strAction = "window.open('http://myserver/insurance/Attachments/Forms/Upload.aspx?&RelatedDocumentID="+currentItemID+"');";
      var strImagePath = "/_layouts/images/attach.gif";
      // Add our new menu item
      CAMOpt(m, strDisplayText, strAction, strImagePath);

      var strDisplayText2 = "View Attachments";
      var strAction2 = "window.open('http://myserver/insurance/Attachments/Forms/AttachmentForContract.aspx?&ID="+currentItemID+"');";
      var strImagePath2 = "/_layouts/images/attach.gif";
      // Add our new menu item
      CAMOpt(m, strDisplayText2, strAction2, strImagePath2);


      // add a separator to the menu
      CAMSep(m);

      // false means that the standard menu items should also rendered
      return false;

      }
      </script>
    • In the attachment library we have a lookup column to the base document library, so we have to set a default value to the base contract. This contract's ID is passed by ID parametet.
    • That's all :) The AttachmentForContract.aspx is a custom list of contracts filtered by ID parameter. If the user click to View attachments menu, he/she will be redirected to this page, and he/she can see the attachments for base contract passed by ID parameter.

     

    In the next part, I'll show you how you can develop a custom field, which is responsible for rights management on a list item or a document.

     

     

  • LINQ4SP - Delete a list item

    OK, let's play with LINQ4SP again.

    You can download Beta1, write a simple query, create a new list item and lookup fields. In the next part I'll show you how to delete an item from a list:

            [TestMethod]
    public void DeleteCreatedItems()
    {
    using (AwContext context = new AwContext())
    {
    var q = from subCategory in context.ProductSubcategory
    where subCategory.Title == "new sub category"
    select subCategory;

    foreach (ProductSubcategory psubcat in q) psubcat.DeleteOnSubmit();


    var p = from product in context.Product
    where product.ProductNumber == "AA" ||
    product.ProductNumber == "Double test" ||
    product.ProductNumber == "Date test"
    select product;
    foreach (Product prod in p) prod.DeleteOnSubmit();

    var z = from pc in context.ProductCategory
    where pc.Title == "new product category"
    select pc;
    foreach (ProductCategory prodcat in z) prodcat.DeleteOnSubmit();

    context.Submit();
    }
    }
  • LINQ4SP Beta1 is here!

    I'm really happy to announce: beta1 release of LINQ4SP is available, and can be downloaded. If you are interested, you can find the install kit and Release Notes on this URL..
    If you have tried it or just generally have some thougths please feel free to comment here or e-mail me at molnar.agnes{at}lmsolutions.hu

    If you find any bugs, and would like to report it to the developers, here is the issue tracker of the project: bugs.lmsolutions.hu - after opening site select project LINQ4SP.

    As this will be a commercial product in the near future, active testers will be rewarded if they decide to buy our solution later on.

  • LINQ4SP - How to create a new item with a lookup to another list?

    Well, how do you like our solution to query a list or insert a new item to a list by LINQ4SP? What do you think about it?

    What would you tell, if I show you a newer interesting thing? Are you ready? - OK, today surprise is how to insert a lookup reference to another list. See this short demo, or check a piece of code here:

                    // Create a new Category
                    ProductCategory pc = new ProductCategory()
                    {
                        Title = "new product category",
                    };

                    // Create a new Sub-Category item
                    ProductSubcategory pcat = new ProductSubcategory()
                    {
                        Title = "new sub category",
                        ProductCategory = pc
            // <<-- WOW! This is a lookup to Categories...
                    };

                    // Submit our new Sub-Category
                    context.ProductCategory.InsertInSubmit(pc);
                    context.ProductSubcategory.InsertOnSubmit(pcat);
                    context.Submit();

    So, how do you like it?...
  • LINQ4SP - Create new list item

    Well, we can query our SharePoint lists with LINQ4SP, that's great.

    But what about data manipulation? Can we create, modifiy or delete items as well? My answer is: yes, we can! We are able to create new item, modify or delete items with LINQ4SP!

    First of all, let's see an item creation: we'll insert a new Product item to our Products list. This list is migrated from AdwentureWorks database, with some other tables. We don't need the whole AdwentureWorks database for our demos, so we migrate only a few tables, as you can see on the following schema. One special thing is, that we don't have ProductVendor list, but it't just represented by a multi-lookup field between Vendor and Product lists (of course, with no additional fields).

     

    So, in this demo I'll show you how to insert a new Product into the SharePoint list. Are you ready? Click here for video... 

  • LINQ4SP - Simple Query

    In the last demo I showed you are able to generate the context and business classes with the LINQ4SP code generator.

    This time I would like to go through and easy query generation and some basic filtering.

    First we generated the context from a SharePoint list and created a test project. This is, where the current video starts...

    More to come, stay tuned ! 

  • Architect Academy in Hungary

    Microsoft Hungary will start a new, intensive training series  for architects and senior developers. The main goal is to give a wide and deep architectural knowledge for participants.

    The Architect Academy's main topics are:

     

    • development methods and tools
    • design patterns
    • development tools: application lifecycle management (ALM), TFS+VSTS+EPM
    • application platform: .NET, WCF/WF/WPF/CS
    • application platform: DSI
    • application platform: application integration, ESB/ISB
    • application Platform: SharePoint, OBA
    • application platform: business intelligence (BI)
    • user experience (UX)

     

    I'm one of the trainers - maybe you are not surprised, if I tell you: my topics are SharePoint and OBA: Is SharePoint a development platform? What benefits do you have during SharePoint developments? What about Workflow, InfoPath Forms Services, BDC, etc. - and of course, what is OBA? Where is its place in our project, how can it help our customers' work?

    I think it will be a really useful and exciting training-series - if you are interested, register here.

  • LINQ4SP - Code Generator

    As we're planning to release LINQ4SP Beta1 at the end of this week, let's start to show some pieces of it!

    First of all, I'll show you how you can browse your site's content, and select what you want to use in the generated code. You can select lists, columns, lookups, etc. After finishing the selection, you can open and use the source file. If you want to see, how does it work, click here for a short demo.
     

  • Announcing LINQ4SP

    If you are a SharePoint developer, most probably you have heard about the LINQ to SharePoint project on CodePlex. You may have also tried it several times. Our company did that too, but after deeper investigations we decided to create our own LINQ implementation, LINQ4SP. Why?
    Here you can find our reasons:
    • Our architecture is built on design patterns and has a clean and easy maintainable structure. We make use of the visitor pattern by evaluating the LINQ expressions as is the case in other LINQ implementations. This reduces the code, simplifies the structure and creates an easy extendable solution.
    • Our code generator operates SPWeb based, not SPSite based, so it’s not limited to the lists on the root web of every site collection.
    • We make use of internal names instead of the display names, which makes it possible to alter the list definitions and wording as the end users whish, it will not crash the applications developed with this library.
    • Support for all built in column types of SharePoint 2007 and plan to add support for custom fields too.
    • This solution will be well and thoroughly tested, supported and further developed, because it’s already used in our everyday work in our running implementation projects.
    • Our implementation has support for list item creation, altering and deletion.
    • Our implementation has support for content types both in the code generator and in the query syntax. It’s possible to query list based on the assigned content types.
      • Support for content type inheritance. This means: for example, you have content type A and B, where both inherit from C. If you have a list, where you only attach A and B to, you will still be able to query the list based on the common content type C.
      • Support for special content types:
        • Folders
        • Documents
    • Our implementation comes with an operation based context based (a separate context for every session)      

    You can find a detailed feature-by-feature comparison in the following table.

     

    So we are proud to announce the upcoming beta1 release of our LINQ4SP library. Are you interested?

    Stay tuned! 

  • Announcement: OBA Composition Reference Toolkit 2.0

    Good news: the OBA Composition Reference Toolkit 2.0 is ready to use!

    Version 2.0 (V2) of the OBA Composition Reference Toolkit evolves the Version 1.0 release of the Toolkit to add information technology (IT) administration capabilities, a prescriptively secure user experience for OBA composition, and incremental deployment of OBAs. The V2 release also provides support for installing the OBA Composer on a client computer that is running the Windows Vista operating system and connecting to a remote computer that is running Office SharePoint Server. The release provides support for many new, out-of-the-box components, too, which cover scenarios that pertain to Expense Reporting, Purchase Requisition Management, Financial Services, and Health & Life Sciences solutions.

    The V2 release also includes the source code (framework, tools, and sample components) of the OBA Composition Reference Toolkit to enable independent software vendors (ISVs) and solution integrators to extend and repurpose the Toolkit to suit their individual needs.

    In the next days I'll update my OCRT server, install the client to my Vista - and of course, start to create my own components :)

    If you are interested, you can find more information about OCRT 2.0 in these documents:

     

    To be continued...


Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts