Delen via


Office AMS v2.0 has been released

We are happy to announce new version for the community driven Office App Model Samples (AMS) project. This CodePlex project has been created to share different community created CAM or SP App scenarios for the benefit of the community. We will be revising and enhancing the AMS samples and they should be considered just that, samples.

Like with first version, this updated package is released by a group of volunteers who are committed to continue further expanding this sample package in the future. Feel free to use the example code and scenarios in anyway you need within your projects or customer work. Notice thought that the code examples are provided as is and we don’t have any support model for them, so you need to take responsibility on using them case-by-case basis. Currently package contains mainly implementations for the SharePoint side (except one mail app), but we are looking to extend it more with Office client apps as well.

From the community to the community” – “Sharing is caring

Introduction to v2.0

Updated material has been released in Office AMS CodePlex site in address https://officeams.codeplex.com. We will continue updating this package with additional scenarios and examples based on the feedback from the community. Your input is extremely important for us to understand what kind of scenarios should be included.

Here’s release presentation for the v2.0 release with some additional details and information on the content. Key pointers from the presentation have been included to this blog post.

Key changes in the version 2.0 package

In version 2.0 we have refactored the package to help you to find the relevant information more easily. Provided samples have been split to four different categories and we’ve introduced a new reusable remote operation component to promote code re-use. All the samples which we had in the v1.0 have been refactored to the new structure and there’s significant amount of new samples projects included from the Office AMS team and from the community. Package contains now overall more than 40 Visual Studio solutions, which are all documented and have specific additional information for specific functionality.

Samples have been group to different categories based on their type of the sample

  • Components – These are reusable components for apps
  • Samples – These are independent samples demonstrating capability or functionality
  • Scenarios – These are scenario apps, which demonstrate usage of the Office AMS Core remote operation component
  • Solutions – These are more complex and comprehensive solutions which combines multiple different techniques

We’ve also used specific naming conventions for the samples. This should also help on finding exactly what you’re looking for from the package. Additional details on the package in following chapters or from referenced PowerPoint presentation.

Core componentimage

Office AMS Core component was created to promote code re-use, so that examples and solutions can utilize the same code without copy pasting. This initial release is still pretty simple, but we have long backlog for improvements and additional capabilities for this components. This component can be used as such in any project to automate simple remote operations.

Core component is using same namespace as the Microsoft.SharePoint.Client objects, so that the extension methods to normal CSOM objects are available immediately when you add a reference to the component. This will make the usage of the these generic operations as easy as possible.

All the solutions categorized as Scenarios or Solutions uses this centralized component for the remote operations.

Example usage of core component extensions

All the Core component methods are introduced as extension methods to existing CSOM objects. Here’s example usage of the extension methods with SharePoint CSOM objects.

Adding new list to web

 var spContext = SharePointContextProvider.Current.GetSharePointContext(Context);
 using (var ctx = spContext.CreateUserClientContextForSPHost())
 {
     // Create new document library if it does not exist
     if (!ctx.Web.ListExists("Specifications"))
     {
         ctx.Web.AddList(ListTemplateType.DocumentLibrary, "Specifications", false);
     }
 }

Creating new content type to web

 var spContext = SharePointContextProvider.Current.GetSharePointContext(Context);
 using (var ctx = spContext.CreateUserClientContextForSPHost())
 {
     // Create a document content type inherited from Document
     string contentTypeId = "0x0101001f11771d89214705b6c4baf77b0f219c";
     string contentTypeName = "LitwareDoc";
  
     // Notice that followign line does break if the content type already exists
     if (!ctx.Web.ContentTypeExistsByName(contentTypeName))
     {
         ctx.Web.CreateContentType(contentTypeName, contentTypeId, "Contoso Content Types");
     }
 }

There’s many many more extensions included in the package and we have long backlog to improve the component with commonly needed operations.

Office AMS v2.0 package structure

Here’s a short description of the Office AMS v2.0 package. We have re-factored the folder structure for helping on getting started. We’ve also included latest client side components for both 15 and 16 versions. 15 versions is the latest CSOM for on-premises and the 16 version is the latest CSOM package for Office365. 16 version CSOM objects will also work in on-premises for all matching operations. Any new capability introduced in the cloud, won’t obviously work.

image

Each sample has also following standard structure, meaning that they contain additional documentation to provide context and additional details. Documentation contains possible external references and guidance on setting up particular example. If project uses the Office AMS core component, it has been included also to the solution structure.

image

Complete list of persons contributed to latest release

Here’s the full list of involved persons for the current release in CodePlex. We also do have already few additional scenarios pending from additional persons, so this list will just keep on growing with the monthly releases.

  • Alex Randall
  • Amar Bhogal
  • Anna Ngo
  • Bert Jansen
  • Bob Fox
  • Brian Jackett
  • Christian Heide Damm
  • Craig Riter
  • Frank Marasco
  • Freddy Kristiansen
  • Joe Rodgers
  • Johan Skårman
  • Karim Kameka
  • Ken Milne
  • Kiki Shuxteau
  • Kimmo Forss
  • Kirk Evans
  • Koen Vosters
  • Mark Franco
  • Matt Mazzola
  • Michael O'Donovan
  • Richard diZerega
  • Rob Howard
  • Sean Squires
  • Shariq Siddiqui
  • Sonya Koptyev
  • Steve Walker
  • Suman Chakrabarti
  • Tom Van Gaever
  • Vesa Juvonen
  • Wayne Ewington

Future for Office AMS

Like mentioned in the Jeremy Thake’s sessions in European SharePoint conference 2014, Office AMS project is turning into as open source project. This will give us opportunity to start taking contributions from the external field. We are still sorting out some details, but this should happen during June. As part of the this changes, we are also planning to move Office AMS from CodePlex to GitHub as a own repository in the Office Dev section, where you can find already other open source content.

We will keep you updated on these changes using blog posts, Facebook and Twitter.

Planned schedule

Now that the code refactoring for v2.0 has been completed, we are planning to provide updates in monthly basis. Target for the following version is to move the home of the project from Codeplex to GitHub and to turn project open source, but even though there could be some delays on the move, we will be releasing some new samples also during June in the monthly release.

image

How to provide feedback and suggestions

Please do give us feedback and input on the work which has been released. Your feedback is crucial for this program and we are committed on providing additional scenarios and samples for the benefit of all of us. Primary purpose is to provide samples and IP for the community by the community and program existence is obviously dependent on the usefulness for the field. 

If you find any bugs in the release, please use the discussions and issues in the Codeplex project for now. This will be changed when project will move to GitHub. We have already long back log of the core component operations and other new updates, but all input is highly appreciated.

image #officeams tag in Twitter    
image   https://www.facebook.com/officeams

We are also highly interested on any possible gaps you might be encountering with the remote APIs, so that we can provide input for the product development. If you want to provide feedback related on the product API or functionality gaps, please use the https://officespdev.uservoice.com for providing input for the product group.

Thanks for your assistance with the SharePoint app adaptation. If we can build on shared community knowledge, we can be much more efficient and productive, which benefits all of us.

“Sharing is caring…”

Comments

  • Anonymous
    May 14, 2014
    Dear Vesa I have followed OfficeAMS since its start, and I really appreciate this release, its kind of what I was looking for, the Core is really useful.  I wonder if the following idea might be something useful or not: Lets suppose in a project you need to create 1000 sites with 100 content types and 10 fields each, doing this by code would take a lot of time. I was thinking in creating an app, in which the user(developer) would create an xml file (schema defined by me), but that looks like similar to the ones we are used to, the app will read the xml contents and use the Core dll to create content types, fields, etc. So, developers wouldnt need  to repeat code over and over again (instead do some xml). On this xml I would do something for schema upgrades, lets suppose you have to add a new field to a content type, then in the xml I would define some upgrade actions to add/edit/delete fields, (like the feature upgrade). What do you think about this idea, do you see any flaw on this that can have problems in the future? would you see this a  good idea that could be included in future releases of AMS? Your input is appreciated Thank you

  • Anonymous
    May 14, 2014
    lol, just posted the above post as Anonymous :(

  • Anonymous
    May 15, 2014
    Luis, if you need to create 100 content types, with 10 fields each, in declarative XML you would have: <Field > ... field definition 1 <Field > ... field definition 2... etc, for 1,000 fields <ContentType > ... content type 1  <FieldReference > ... reference 1  <FieldReference > ... reference 2, repeated for 10 references ... then the whole lot repeated 100 times This totals up to around 2,100 XML elements. Writing it directly in code, you get: ctx.Web.CreateField() ... field 1 ctx.Web.CreateField() ... field definition 2... etc, for 1,000 fields ctx.Web.CreateContentType() ... content type 1  ctx.Web.AddFieldToContentTypeByName() ... reference 1  ctx.Web.AddFieldToContentTypeByName() ... reference 2, repeated for 10 references ... then the whole lot repeated 100 times All up, the same 2,100 lines, but this time of code. Repeating XML over and over is really no better or worse than repeating code over and over.

  • Anonymous
    May 16, 2014
    very good point, thanks for pointing that out :)

  • Anonymous
    May 19, 2014
    The comment has been removed

  • Anonymous
    July 14, 2014
    Hi Vesa, I need some assistance with respect to deploying Office AMS (App Model Samples) on our on premise provider hosted development environment. I have downloaded the new set of sample code (latest release) available in codeplex. I am changing the Site URL and trying to run the sample applications but its throwing one or the other errors. Can you point me out what proper configurations I need to set before running the sample apps in a provider hosted environment or if you can point me to any url. Thanks.

  • Anonymous
    July 24, 2014
    The comment has been removed