Posts

Showing posts from June, 2013

10+ Useful SharePoint Client Object Model Methods

Following the console SharePoint COM app we created previously. Now I will show you how to create other useful methods. First Open Visual Studio and create an empty C# Console application, name it SP_COMapp. Add references to Microsoft.SharePoint.Client and Microsoft.SharePoint dlls. (found in Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI \ folder) Your Program.cs should have something like this using Microsoft.SharePoint.Client; using Microsoft.SharePoint; Next make sure the reference Copy Local property for these dlls are set to True. (Solution Explorer > Expand References > Click the references > Properties Window > Copy Local > True) Ok now we're good to go. The namespace region should look like this. namespace SP_COMapp { class Program { static void Main(string[] args) { } } } Now our COM methods will be as follows: List Sites place this inside the Program region not on the main, w...

SharePoint Client Object Model for SharePoint Server and Office365 difference

This post will show you a minor difference between creating a SharePoint Server COM application and a Office 365 COM application. This is really quick and easy ;) Alright! First for the SharePoint Server COM application. I've created a C# console application. Add these references for the application. using Microsoft.SharePoint.Client; using Microsoft.SharePoint; Create a COM function, for now I'll show you how to create a site. The rest of the COM functions, I'll show on another tutorial. ;) namespace SP_COMapplication { class Program { static void Main(string[] args) { CreateSite(); } public static void CreateSite() { using (ClientContext ctx= new ClientContext("http://sharepoint server url")) { if (ctx != null) { string blogDescription = "Sample Site"; int blogLanguage = 1033; ...

TMS WebPlanner Insert, Update and Delete Events [TMS Tut Part 3]

Following the 1st and 2nd tutorial for binding and setting up your TMS WebPlanner ASP page. I will show you now  how to initialize the insert, update and delete events in our project. First we initiate our WebPlanner object to have the ff. events: ** Write this code before invoking the databind function in Page_Load WebPlanner1.EventInserting += new PlannerEventInsertingEventHandler(WebPlanner1_EventInserting); WebPlanner1.EventUpdating += new PlannerEventEventHandler(WebPlanner1_EventUpdating); WebPlanner1.EventDeleting += new PlannerEventDeletingEventHandler(WebPlanner1_EventDeleting); Don't worry about the errors for missing events used in the lines above. We will create them soon enough. Alright once that's done, we need to create a database connection for these events. In this tutorial I'm using an OleDB to create a connection and do the events. Add the following references: using System.Data.OleDb; using System.Data; Create a string variable named...

TMS Web Planner code behind database binding [TMS Tut Part 2]

On Solutions Explorer, right-click the Planner.aspx file. Select View Code on the popup. The aspx code behind is still raw, so first we need to add essential references like TMS.WebPlanner and TMS.WebPlanner.Design. Code behind header should have these lines: using TMS.WebPlanner; using TMS.WebPlanner.Design; To connect our database to the webplanner. We put this following lines on the Page_Load method: WebPlanner1.DataSource = AccessDataSource1; This connects the Access DataSource object we added earlier to our TMS WebPlanner. These WebPlanner properties need to be defined in Page_Load. WebPlanner1.KeyField = "ID"; WebPlanner1.StartTimeField = "StartTime"; WebPlanner1.EndTimeField = "EndTime"; WebPlanner1.SubjectField = "Subject"; WebPlanner1.NotesField = "Notes"; Lastly! we add this line to complete the data bindings. WebPlanner1.DataBind(); On the 3rd part of this tutorial, I will teach you how to create the WebPla...

Setting up TMS Web Planner and Access Database [TMS Tut Part 1]

First: create the database named Planner.accdb, create a table named Scheduler inside with the ff fields: Field:  ID             Type: AutoNumber Field:  Subject     Type: Text Field:  Notes       Type: Text Field:  StartTime  Type: Date/Time Field:  EndTime   Type: Date/Time We will add necessary fields later. As for now that would do fine for a prototype. Second: create an empty C# web application project in Visual Studio. Make sure your TMS Web Planner Controls has already been integrated with Visual Studio Toolbox. On your solution explorer right click and create a new folder named "Planner", add an empty ASP item on that folder name it "Planner.aspx" Right-click on Planner.aspx file and select design. Drag and drop an Access DataSource object under Toolbox on Visual Studio. Now configure the Access DataSource and connect it to the Planner.accdb file. I suggest you put the acc...