Thursday, August 25, 2011

Using ADO.NET Data Services











using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Linq;
using System.Net;

namespace ProjectManagers
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        MyDataService.MeetingMangementDataContext ctx = new MyDataService.MeetingMangementDataContext(new Uri("http://crm-server:6861/_vti_bin/ListData.svc"));

        private void Form1_Load(object sender, EventArgs e)
        {
            ctx.Credentials = CredentialCache.DefaultCredentials;
            var q = from a in ctx.Announcements select a;
            this.announcementsItemBindingSource.DataSource = q;
        }

        private void announcementsItemBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            ctx.SaveChanges();
        }

        private void announcementsItemBindingSource_CurrentChanged(object sender, EventArgs e)
        {
            ctx.UpdateObject(this.announcementsItemBindingSource.Current);
        }

    }
}

1 comment:

Featured Post

Create SharePoint Folder Structure in Destination (Only If Not Exists)

Why This Script Is Safe You can run it multiple times It will not create duplicate folders It will only create missing folders S...

Popular posts