Showing posts with label deleting. Show all posts
Showing posts with label deleting. Show all posts

Thursday, 31 January 2013

Deleting Registry using JavaScript



Root Key Name
Abbreviation
HKEY_CURRENT_USER
HKCU
HKEY_LOCAL_MACHINE
HKLM
HKEY_CLASSES_ROOT
HKCR
HKEY_USERS
HKEY_USERS
HKEY_CURRENT_CONFIG
HKEY_CURRENT_CONFIG

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>Deleting Registry</title>
        <script type="text/javascript">
            function deleteRegistry() {
                var WshShell = new ActiveXObject("WScript.Shell");
                WshShell.RegDelete("HKCU\\Software\\ColdSoft Technologies\\W2SS");
                document.writeln("Registry Deleted Successfully");
            }
        </script>
    </head>
    <body onload="javascript: deleteRegistry()">

    </body>
</html>

Note: This code works only in Internet Explorer.

Wednesday, 30 January 2013

Deleting Items from List in SharePoint 2010 using Client Object Model (C#)



Step 1: Create New Project. (Minimum .NET Framework 3.5)
Step 2: Add “Microsoft.SharePoint.Client” and “Microsoft.SharePoint.Client.Runtime” namespaces.
Step 3: Write the following code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//SharePoint namespace
using Microsoft.SharePoint.Client;

namespace DeletingListItems
{
    class Program
    {
        static void Main(string[] args)
        {
            string siteUrl = "http://sharepointserver.com";
            ClientContext clientContext = new ClientContext(siteUrl);
            clientContext.Credentials = new System.Net.NetworkCredential("admin", "password", "sharepointserver.com");
            Web site = clientContext.Web;

            //Getting List
            List list = site.Lists.GetByTitle("Students");

            //Deleting List Item
            ListItem listItem = list.GetItemById(2);
            listItem.DeleteObject();
            clientContext.ExecuteQuery();

            Console.WriteLine("List Item Deleted Successfully");
            Console.ReadLine();
        }
    }
}


Deleting List in SharePoint 2010 using Client Object Model (C#)



Step 1: Create New Project. (Minimum .NET Framework 3.5)
Step 2: Add “Microsoft.SharePoint.Client” and “Microsoft.SharePoint.Client.Runtime” namespaces.
Step 3: Write the following code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//SharePoint namespace
using Microsoft.SharePoint.Client;

namespace DeletingLists
{
    class Program
    {
        static void Main(string[] args)
        {
            string siteUrl = "http://sharepointserver.com";
            ClientContext clientContext = new ClientContext(siteUrl);
            clientContext.Credentials = new System.Net.NetworkCredential("admin", "password", "sharepointserver.com");
            Web site = clientContext.Web;

            //Deleting List
            List list = site.Lists.GetByTitle("Students");
            list.DeleteObject();
            clientContext.ExecuteQuery();

            Console.WriteLine("List Deleted Successfully");
            Console.ReadLine();
        }
    }
}