Showing posts with label SharePoint Apps. Show all posts
Showing posts with label SharePoint Apps. Show all posts

Developing Apps for SharePoint 2013 - Dubai Nov 6

Tuesday, December 3, 2013








At the heart of Dubai Internet City, UAESPUG delivered the first session in Dubai on Developing Apps for SharePoint 2013 in Microsoft's auditorium.

The event proved to be a success with an overwhelming attendance of more than 60 professionals and enthusiasts, representing the IT industry in the UAE. 
The two co-speakers, Usama Wahab Khan and Jamil Haddadin did an amazing job of introducing the topic clearly and effectively. They did their best to ensure that everyone was able to grasp the major concepts required in developing SharePoint 2013 apps. 

The feedback received after the session on different aspects (presentation, topic, speakers etc.) was very encouraging and points of improvement were noted for even better events in the future. 

Success of the event is contributed to the great efforts done by the speakers and, more importantly, the lively audience who took their time to attend and participate with their ideas and discussions. 

In addition, the event could never have been a success if it wasn't for the great team work behind the scenes to prepare and organize the session. Finally, we are grateful to have Microsoft host the event at their auditorium.

Great Team, Great Effort.

Join us for Future  Community Activities. 
http://spuae-public.sharepoint.com

Follow us

SharePoint 2013 App authorization policy (RunWithElevatedPrivileges for App )

Friday, August 23, 2013


 Allots of People ask Question’s on MSDN SharePoint 2013 forums. how they can host app on their public site. They want to use App Modules for Public facing site which have anonymous right or current user does not have permissions to. something like Elevate Privileges in developer`s term Elevate Privileges in App Module.  What i think Many developer start working API by small tutorials , sample code ,HOL and didn't understand what SharePoint 2013 New API is doing. new App Module is away with normally impersonation confusion and make it very clear for developers there is  no impersonation capability in the SharePoint 2013  API . so if  Elevate Privileges ,impersonation is not there how can  get thing to be done?. SO answer is the "App Only Policy".

The App Only Policy
In a Scenario App have to some work where current user does not have Permission. We will use “The App Only Policy”. When user did not provide any Kind of credential. An Oath access token is present but does not contain user information.  than we will evaluated the  permissions based App instead of user.
Authorization in SharePoint 2013 is divided in to two types of Entities.
 1st Permission for users.
2nd Permission for Apps.

App authorization policies types

 User-only policy—This user-only policy is the authorization policy that was always applied in SharePoint 2010. When the user-only policy is used, the authorization checks take into account only the user identity. An example of when this policy is enforced is when the user is accessing resources directly without using the app.

User + app policy—When the user + app policy is used, the authorization checks take into account both the user identity and the app identity. In particular, when this policy is used, authorization checks succeed only if both the current user and the app have sufficient permissions to perform the action in question.
An example of when this policy is used is when a SharePoint site has an embedded IFRAME that links to a Office Store app, and the app calls back to SharePoint to access SharePoint resources on behalf of the user. That is, when a Office Store app, which does not run in SharePoint Server, wants to act on behalf of the user to get access to the user's resources.

App-only policy—When the app-only policy is used, the content database authorization checks take into account only the app identity. In particular, when this policy is used, an authorization check succeeds only if the current app has sufficient permissions to perform the action in question, regardless of the permissions of the current user (if any).

Oath requires to generate App token. So App- Only Policy can only be used for  Auto Hosted Apps or  Provider Hosted Apps.  
SharePoint hosted Apps cannot use App-only policy.


To request  app to  use App-only policy  your app need to add attribute called “AllowAppOnlyPolicy”  in tag node of AppPermissionRequests with true value.             User Must be Site Collection Administrator for allow use of the app-only policy. 

On Code




Reference and Helpful Links
http://code.msdn.microsoft.com/office/SharePoint-2013-Make-app-6e3d1ee9



By Usama Wahab  Khan

CSOM SharePoint app 2013 External Services by Using WebProxy

Monday, July 29, 2013


To Create Call External Web Service in SharePoint 2013 App.  we need to WebProxy class to execute web Service Request in CSOM.  Let Create external Web service in SharePoint 2013  Sample App. remember SharePoint App Developer environment should configured.

  • How to: Set up an on-premises development environment for apps for SharePoint
  • How to: Set up an environment for developing apps for SharePoint on Office 365

    You can also  use Office 365 SharePoint Online.

  • Open Visual Studio and Create SharePoint 2013 Project.


    Add your Test or developer  Site URL


    Open App.Js File from solution Explorer. Cope the Following from Sample code and Paste into App.js


    To Call External URL from App you need to set Permission for that URL in you App Manifest

    Add your External Web Service  URL in Side tag in my case i am using free online sample of northwind Database which avaliable on services.odata.org domain name.

    Open your default.aspx file in App and SP.runtime.js  and Also Executed SharePOint Ready method  

    Define html Container with ID in my case i used message in js code so i defined tab with id
     and Hit F5


    Download code Link :http://code.msdn.microsoft.com/SharePoint-Call-External-83b49a85

    Related Content

     By usama wahab khan

    Autohosted app Uploading a large file to an SharePoint 2013

    Sunday, May 26, 2013


    if you trying to upload Large file to you AutoHosted App some thing like 1.5 Gb which more time to execute then you will receive and error especially if you're using MVC.

    Add in app web.config :)
     


           
             
               
             
           
       

    SharePoint 2013 WebPart vs AppPart and Cloud App Module Advantages

    Tuesday, May 21, 2013


    WebPart Vs App Part

    Web Part
    App Part
    Run on SharePoint Server
    Run on external servers or Browser
    Run  with User Permissions or will full Permissions (elevated Privilege)
    Run with App Identity that is granted specific Permission.  
    Runs in the Same Domain and environment of the page and its content.
    Runs on Different domain providing complete client -side isolation
    Could take up a significant amount of CPU cycles for complex operations
    Executed outside SharePoint hence SharePoint performance is  not impacted
    Not easy to publish globally / locally. It requires installations and activations.
    Can be published internally and or to the Microsoft public SharePoint Store



    Migrate WebPart to App Part
    Migrating Web part to App Part are not 1 : 1 Mapping for code because might be Web Part is Server Side API which not available in App Part. 
    To migrate your web part to App Part you have determined hosting Option. Is App Part run in client or its external server? If your web Part contains any kind of intellectual property that you need to secure you should have to use external server. Because client side code is not very secure and easy to reverse engineered. 
    Choosing right API which is very important if you're creating SharePoint Hosted App than you have three Option for CSOM flavours : 
    JavaScript
    Silverlight
    Rest.
    And if you're doing SharePoint Cloud Hosted App Part you have two flavours.
    . Net 
    Rest
    Which you pick it depends on allot of App Requirement and developer skill that you feel more comfortable with it. .net by using .Net you have a much better developer environment and Rapid Application development and with Rest you can take leverage of the new modern style of development.

    Evolution of customizations in SharePoint
        Microsoft office SharePoint 2007
    Required IT to Deploying Custom Solution by Console and GAC manually. 
        Microsoft SharePoint 2010
    SharePoint 2010 Sandbox Solution AKA partially trusted and user code solution. 
    Sandbox deployed by Site Collection Administrators.
    Only subsets of Server site API available and external database and web service call is not allowed.    
    Can deploy on SharePoint online. 
            Microsoft SharePoint 2013
    •         Cloud App Module which runs Outside the SharePoint server 
    •         Better life cycle installs > update > install. 
    •          App Store to Manage Apps.


    Advantages Cloud App Module.
    If your organization is really looking for a Cloud Scalable Solution. This is the Right Architecture for you. The Cloud App Module is running totally outSide the SharePoint. Which allow developers to manage their app isolated with effecting other Solutions or farm itself  You can update your Apps without re installing and activating them. In case of error or bug your app will not effect on whole farm which helps SharePoint Administrators allot.  By using Cloud hosted App Module you take lavage of new web standards like MVC, MVVM, Html 5, Jquery. At the same time you take all advantages of SharePoint with chrome control cross domain library. SharePoint list is not recommended for highly transactional or Relationship data Module. In App Module You can access Data outside the SharePoint and external resources. Like Web services and SQL and take lavage with your app module. 

     SharePoint 2013 app module much better development life cycle than SharePoint 2010. Which meet the fashion of modern App development and publishing life cycles.


    SP App Design - A Choice of Three Approaches









    Open Module Popup Dialog SharePoint 2010

    Monday, May 6, 2013

    Fastest Way :)


    function OpenPopUpPage(url, callback, width, height)

    function OpenPopUpPageWithTitle(url, callback, width, height, title)

    function OpenPopUpPageWithDialogOptions(dialogOptions)




    Or  you can use this Custom Function

    //Add Dialog for Update,New Forms


    function dialogfunction(pageUrl) {
        var options = { url: pageUrl, width: 400, height: 300 };
        SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
    }






    To Use above Function need Following SharePoint
     JavaScript libraries


    SP.UI.Dialog.js
    SP.Core.js
    SP.js,




    Create an external content type from an OData source in SharePoint 2013

    Sunday, May 5, 2013

    External content type are is core part of Business Connectivity Services. which allow you create content type for external data to collaborate  with SharePoint. its more meaningful way to  interact  external data. you use your LOB Application with SharePoint 2013 and Performed CURD Operations. 

    More About BCS 



     Prerequisites

     Microsoft SharePoint 2013
    VS2012 with SharePoint 2013 Tools Developer 
    Published OData Service . Sample free OData Sources List


    1 Open VS2012  and Create New Project. Visual Studio >New Project >Office/SharePoint>App>Apps for SharePoint 2013.

    2 Enter Your Project and Click Ok.

    3 Enter your App Name and insert SharePoint Site URL where you want to debug or use it.
    4 Select "SharePoint-Hosted" in type of host you want to select for you app.
    5 Right Click on Solution Explorer in Visual Studio> Add > Content Type for an External Data Source.
    6 It will Open SharePoint Customization Wizard Add external  Data Source Name and URL for Odata Service. 

    7. Select Entities that you want to Create ECT then Click on Finish 

    8. Once you create ETC It will Create one Sub folder in Solution under ETC which have by default List for that ETC. 

    9.  Right Click On AppManifest.xml from Solution in Visual Studio select View Code then change the Value of attribute called " " with this ~appWebUrl/Lists/Employee.
    10. Click  F5 to test and Deploy. go to you site > Site Content and you will your new app is there click on it.



    Click on any of these item then you can see all information is here you can edit these recorded it depend on you service as well. 
    for that you have create you own WCF Data Service then you can modified Records 



    .List will not Appear in Site this Site Content for that you have Understand SharePoint  App Security and Storage Module. here MVP CHRIS O'BRIEN explained it very beautifully.


    If have any other Questions Regarding that kindly Email me @ usamawahabkhan@gmail.com.


    By Usama Wahab Khan 

    TypeScript For SharePoint 2013

    Saturday, April 20, 2013



    SharePoint App and JavaScript CSOM.

    Major change in Microsoft SharePoint 2013 development Module  is SharePoint Apps . Previously We have 2 types of solution in SharePoint 2010 1  Farm Solution and  Sandbox Solution. Farm Solution  used full server side SharePoint API and Run SharePoint worker Process. And Sandbox have few limitations  and partially trusted solution which run under the site collection. The biggest change in SharePoint 2013 is App  Solution. Where everything is running outside the SharePoint . App Module is all about HTML 5 , Javascript, Jquery , CSS , Json, JavaScript CSOM. Mainly.  Microsoft greatly enhanced and improved JavaScript CSOM. To meet the Enterprise Development Requirement. SharePoint 2013 Developers need more JavaScript skills to build  large scalable Apps based on JavaScript CSOM. Which required better and highly-productive development tools .Which helps to build robust Apps. So Answer is Typescript,light switch Visual Studio 2012.

                                          
    Typescript
    The typescript is designed by Microsoft language for Large JavaScript based Application and Module Development .The typescript is a typed superset of JavaScript that compiles to plain JavaScript. And Provide great OOP advantages. You can create
    Optional types, classes, and modules to develop large JavaScript programs. Its free and Open Source language which designed by Anders Hejlsberg lead architect of C#. You can extend JavaScript syntax without any changes. Typescript plugin is
    Available for Visual Studio 2012 where you can get maximum advantage of working on strong typing and intelligence.  Which make your JavaScript Development Very easy.

    Download:  Play : Learn http://www.typescriptlang.org

                                                

    SharePoint Typescript Definitions
      Type definitions is required for information about Types of variables, parameters, methods, Classes, Modules. Which is by default not available for SharePoint. Might be at some later stage Microsoft Will Provide that OOB. But now thank to the Passionate Typescript Community. MVP Andrey Markeev and  Stas Vyshchepan. Create Open Source  Type Script Definitions  for SharePoint Project on Codeplex . Advantages of SharePoint Type Script Definitions is when you are working on SharePoint 2013 App Module or JavaScript CSOM. By using Typescript with Typescript Definitions for SharePoint you get leverage of OOP, and benefit from strong typing and intelligence.
    http://sptypescript.codeplex.com/



    1. Client Side Object Model (CSOM) core classes
      • SP namespace (ready)
      • SP.WebParts (ready)
      • SP.Utilities (work in progress) - DateUtility and HttpUtility classes aren't ready yet
      • SP.SOD (ready)
    2. Social object library
      • SP.Sharing (ready)
      • SP.UserProfiles (ready)
      • SP.Social (ready)
    3. SharePoint Client Side Rendering 
      • SPClientTemplates (ready)
    4. Workflows
      • SP.Workflow (ready)
      • SP.WorkflowServices (ready)
    5. SharePoint UI elements:
      • SP.UI.Notify (ready)
      • SP.UI.Status (ready)
      • SP.UI.Menu (ready)
      • SP.UI.ModalDialog (ready)
      • SP.UI.ApplicationPages - some useful stuff here nobody knows about e.g. ClientPeoplePickerWebServiceInterface! (ready)
      • CalloutManager (ready)
      • SP.UI.TileView (planned)
      • SP.UI.Controls (planned)
      • SP.UI.ComboBox (planned)
    6. SharePoint Search
      • Microsoft.SharePoint.Client.Search (ready)
    7. Business Connectivity Services
      • SP.BusinessData (ready)
    8. SharePoint Managed Metadata
      • SP.Taxonomy (ready)
    9. SharePoint Publishing Infrastructure
      • SP.Publishing (planned)

    SharePoint Rest Endpoint and Improvement in SharePoint 2013

    Sunday, February 17, 2013


                                      
    SharePoint 2013 comes again as a great development platform for Enterprise needs and Collaboration with the power of Social Features .In SharePoint 2010 Microsoft introduces Representational State Transfer (REST) service which they have improved  in SharePoint 2013 now REST Services  is fully comparable to the Client object models. Microsoft SharePoint 2013 client object models will have A corresponding REST endpoint. That developers can fully interact remotely with SharePoint data by using any technology that supports REST web requests which Use O Data Standard. The developer can perform all basic CURD (create, update, read, Delete) Operations by O Data Model. 

    OData
                                  
    The Open Data Protocol (OData) is a web protocol for querying and updating data that provides a way to unlock your data and free it from silos that exist in applications today. OData does this by applying and building upon web technologies such as HTTP, Atom Publishing Protocol (AtomPub), and JSON to provide access to information from a variety of applications, services, and stores. (Source: Open Data Protocol site)


    Access SharePoint 2013 REST ENDPOINT
    In Teams to SharePoint 2013 REST ENDPOINT we use URL   http://site url/_api/web.  Previously in sharepoint2010 developers use So many clients. Svc difficult URL for rest service endpoint is still there SharePoint 2013 as well for backwards compatibility.

    Easier Endpoint REST Service URLs
    http://site url/_vit_bin/Client. Svc/web    (SharePoint2010)
    Removing Client.SVC and make it easy To use it with the new url.
    http://site url/_api/ http://site url/_api/web    (SharePoint2013)



    To Use REST Service in SharePoint 2013 have made the HTTP request and serves the appropriate response in either Atom or JavaScript Object Notation (JSON) format. The client application must then parse that response. To Use SharePoint Client Object Model by Rest Service we Need entry Points where we can Access the namespace. Use the names of the APIs from the client object model separated by a forward slash (/). 

    Client object model
    REST equivalent
    ClientContext.Web.Lists
    http://server/site/_api/web/lists
    ClientContext.Web.Lists[guid]
    http://server/site/_api/web/lists(‘guid’)
    ClientContext.Web.Lists.GetByTitle("Title")
    http://server/site/_api/web/lists/getbytitle(‘Title’)


    REST Services Access Points for SharePoint 2013
    Area
    Access point
    Site
    Web
    User Profile
    http:// server/site/_api/SP.UserProfiles.PeopleManager
    Search
    http:// server/site/_api/search
    Publishing
    http:// server/site/_api/publishing










    REST Service open new door and possibility for Developer to create and manage your app for SharePoint 2013 with new web standard like OAuth and OData. SharePoint 2013 Rest Service Also Support Cross Domain cross Domain Library  to Access SharePoint 2013 data from remote apps. By using Cross domain library now app can interact with multiple domains.
    How to Read Data 


    How to Add and Update SharePoint Entities by Using Rest Services
                                      









    You can Perform create and update operation with SharePoint entities by constructing with RESTFULL HTTP REQUEST WITH ENDPOINTS.
     

    How to Delete  SharePoint Entities
     
    More Reference
    http://msdn.microsoft.com/en-us/library/fp142385.aspx