Posts

Showing posts with the label C#

Synchronizing SharePoint Lists Between Internal and External Sites

Image
I have created a sample program to synchronize SharePoint lists between two sites. There are many ways to accomplish this task: 1. SharePoint List Event Handler (ItemAdded, ItemUpdated, ItemDeleted etc.) 2. Custom WorkFlow to copy list items when modified 3. Windows Form to Push Data Manually 4. Windows Service to schedule the move on scheduled times Here is the sample for the 3rd Approach [Windows Form to Push Data Manually]: In this approach. Create a C# Class Library Project and Add a reference to Microsoft.SharePoint.DLL from 12 Hive. Create 2 XML Files [Feature.XML, Elements.XML] to intall the feature. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Xml; using System.Net; namespace AMIMoverByWebService { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btnSync_Click( object sender, EventArgs ...

Emailing Exported File from SQL Server Reporting Services 2005

Image
I have created a sample class to email exported reports [PDF, Excel etc.] from SQL Reporting Services. To do that, I had to add a Report Viewer into the form and set Visible property to False. This web form actually grabs the parameter values from query string and process the report accordingly. You may call this form from another web page and pass the parameters like this:   =================================================== Email form calling function =================================================== private void emailReport() { try { string _period1 = Convert .ToString( Convert .ToDateTime(dtStartDate.Value.ToString()).ToString( "yyyyMM" )); string _period2 = Convert .ToString( Convert .ToDateTime(dtEndDate.Value.ToString()).ToString( "yyyyMM" )); string _division = Convert .ToString(ddDivisions.SelectedValue.ToString()); string _department = Convert .ToString(ddDepartment.SelectedValue.ToString()); string _employee = "" ; ...