Home

Buscar

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

Thursday, December 26, 2013

asynchronous processing


using System;
using System.Collections.Generic;
using Microsoft.SharePoint.Client;

class Program
{
    static void Main(string[] args)
    {
        AsynchronousAccess asynchronousAccess = new AsynchronousAccess();
        asynchronousAccess.Run();
        Console.WriteLine("Before exiting Main");
        Console.WriteLine();
        Console.WriteLine("In a real application, the application can");
        Console.WriteLine("continue to be responsive to the user.");
        Console.WriteLine();
        Console.ReadKey();
    }
}

class AsynchronousAccess
{
    delegate void AsynchronousDelegate();

    public void Run()
    {
        Console.WriteLine("About to start a query that will take a long time.");
        Console.WriteLine();
        ClientContext clientContext =
            new ClientContext("http://intranet.contoso.com");
        ListCollection lists = clientContext.Web.Lists;
        IEnumerable<List> newListCollection = clientContext.LoadQuery(
            lists.Include(
                list => list.Title));
        AsynchronousDelegate executeQueryAsynchronously =
            new AsynchronousDelegate(clientContext.ExecuteQuery);
        executeQueryAsynchronously.BeginInvoke(
            arg =>
            {
                clientContext.ExecuteQuery();
                Console.WriteLine("Long running query completed.");
                foreach (List list in newListCollection)
                    Console.WriteLine("Title: {0}", list.Title);
            }, null);
    }
}

Wednesday, March 14, 2012

Sharepoint :: Feature.XML

<Feauture
  Id="AA661F05-6AE3-4a73-A1BD-13A3BB76F47B"
  Title="Exemplo1"
  Description="Exemplo SharePoint Feauture"
  Version="1.0.0.0"
  Scope="Web"
  Hidden="FALSE"
  ImageUrl="Exemplo1/xpto.gif"
  xmlns="http://schemas.microsoft.com/sharepoint/">

  <ElementManifests>
  <ElementManifest Location="elements.xml"
  </ElementManifests>
</Feauture>

Thursday, March 8, 2012

Sharepoint :: Enable Developer Dashboard

Console Application

using System;

using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace EnableDeveloperDashboard {
   class Program {
      static void Main() {
         SPDeveloperDashboardSettings settings =
SPDeveloperDashboardSettings.ContentService.DeveloperDashboardSettings;

         settings.DisplayLevel = SPDeveloperDashboardLevel.On;
         settings.TraceEnabled = True;
         settings.Update();
         }
      }
}

Sharepoint :: HelloWorld

Console Application
using System;
using Microsoft.SharePoint;


namespace HelloWorldSharePoint {
   class Program {
      static void Main() {
         const string siteUrl = "http://intranet.meusite.com";
         using (SPSite siteCollection = new SPSite(siteUrl)) {
                  SPWeb site = siteCollection.RootWeb;
                  foreach (SPList list in site.Lists) {
                           if (!list.Hidden) {
                                    Console.WriteLine (list.Title); 
                                             }
                                    }         
                           }
                  }         
         }
}