.Net & SharePoint '07

Technical blog for .Net and all SharePoint 2007 related Information

About the author

Me(Prince) and my wife are B.E in I.T & C.S.E respectively.  I a certified MCPD: Web from 2007 Dec. I am Intrestes in Web Application, MOSS, EPM, etc.
Now working with Deira International School, as IT Application & Help Manager. I have started my career as "Software Developer" @  REACH Sewn Technologies and Consulting Pvt. Ltd, Bangalore India from Oct 2004 to Feb 2006, then as "Web & Intranet Developer" @ Fosroc International Ltd, Dubai from April 2006 to Sep 2009.
You can catch me on mail@jpy-tech.com or mail@princepy.com. Or on 00971 - 50 - 4284530 

Google Translate

Tag cloud

Calendar

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

RecentComments

Comment RSS

Google Your Location


How to edit SharePoint Item New / Edit Page?

Add PageView=Shared&ToolPaneView=2 to the URL


Tags: ,
Categories: MOSS | WSS
Posted by admin on Tuesday, May 26, 2009 10:05 AM
Permalink | Comments (0) | Post RSSRSS comment feed

How to get data from your SharePoint lists in XML format?

A technique we used extensively in STS still applies to WSS: How to get data from your SharePoint lists in XML format. It's actually quite simple, and you don't need to use web services to get it.

WSS supports a number of protocols to interact with the data. SOAP and WEBDAV immediately come to mind for most of you, but you may be forgetting the elusive URL Protocol (GET). Luckily for you, it's simple to use, and returns data in the MS-standard rowset stream format.

Follow along with these steps, and you'll be pleased with the results, I'm certain.

Determine the GUID of a list whose data you need in XML.

  • Navigate to the allitems.aspx view of the list in question
  • Click the "Modify Settings and Columns" link on the left side
  • Copy the List's GUID (including curly braces) from the address bar
  • Construct the URL to retrieve the list's data in XML format (it's case sensitive, be careful!)

The requested object is http://servername/sitename/_vti_bin/owssvr.dll

The object will expect three parameters:

  1. Cmd
  2. List
  3. XMLDATA (case sensitive)

Since we're displaying items (in XML format), the value of the Cmd parameter should be Display
We want to grab the list whose GUID we determined in step one; the value of the List parameter is this GUID (including curly braces)
Of course, we want XML data to be returned; the value of the XMLDATA parameter will be TRUE
Putting this together, we get a URL that looks like this:

http://server/site/_vti_bin/owssvr.dll?Cmd=Display&List={E1D9FED5-2531-413F-8C0F-CAA5C6280E51}&XMLDATA=TRUE

Sit back and marvel at how easy it is to get a rowset out of SharePoint without using the Object Model or the Web Services. You can point a Data View web part to this URL and grab data from another SharePoint site without adding the whole site to your DV catalog listing.

You may find that it doesn't return EVERY field. That's right: It returns fields that are defined in the default "allitems" view of that particular list. If you want more fields, you have two choices:

Modify the allitems.aspx view to show more fields (easy)
Pass an additional URL parameter, View, with the GUID value of the view whose fields you want to return (a little more involved/tedious)

thanks soumya dasari


Categories: MOSS | WSS
Posted by admin on Thursday, May 21, 2009 1:19 PM
Permalink | Comments (1) | Post RSSRSS comment feed

SQL Reporting Services(SSRS) Reports In SharePoint (MOSS)2007 [Integrated Mode] throught SQL Server Reporting Services Report Viewer

Install SSRS web parts in integrated mode

 

Coming Soon....

 


Posted by admin on Thursday, May 21, 2009 10:21 AM
Permalink | Comments (0) | Post RSSRSS comment feed

SQL Reporting Services(SSRS) Reports In SharePoint (MOSS)2007 [Native Mode] throught Report Explorer + Report Viewer

Install SSRS web parts in native mode

If you want to access report server content on a SharePoint site from a native mode report server, use the SharePoint 2.0 Web Parts that are included with Reporting Services.
Web parts are delivered to a SharePoint server as a cabinet (.cab) file. Run the Stsadm.exe tool on the .cab file from the command line to install the Web Parts. The Stsadm.exe tool is included in a SharePoint installation.

  1. Copy the RSWebParts.cab to a folder on the SharePoint server. The .cab is installed with Reporting Services. By default, it is located in the C:\Program Files\Microsoft SQL Server\100\Tools\Reporting Services\SharePoint folder, (if missing please download it from here [RSWebParts.cab (23.08 kb)]). You can copy it to any folder on the SharePoint server, and then delete it later after you install the Web Parts.
  2. On the computer that has the installation of the SharePoint product or technology, open a Command Prompt window and navigate to the folder that has the Stsadm.exe tool. The path will vary depending on which version of Windows SharePoint Services you are running. If you are using Windows SharePoint Services 3.0, the path is C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN.
  3. Run Stsadm.exe on the .cab, using the following syntax:
    STSADM.EXE -o addwppack -filename "C:\ Program Files\Microsoft SQL Server\100\Tools\Reporting Services\SharePoint\RSWebParts.cab" -globalinstall

    Specifying -globalinstall adds the Web Parts to the global assembly cache (GAC). This step is necessary if you want to connect the Web Parts.
  4. After you install the Web Parts, you can add them to a Web Part Page on a SharePoint site. You must have permission to create Web sites and add content.

 

Note : If you get the below error

An unexpected error has occurred.

Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator.
Troubleshoot issues with Windows SharePoint Services.


Changing the trust level from WSS_Minimal to WSS_Medium to resolve the problem

Links


Posted by admin on Thursday, May 21, 2009 9:58 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Abstract Spaces


Categories: MOSS | WSS
Posted by admin on Sunday, March 15, 2009 11:08 PM
Permalink | Comments (0) | Post RSSRSS comment feed

[Today] in Calculated Columns

“Calculated columns cannot contain volatile functions like Today and Me”>

When you try to create a calculated column in sharepoint and use [Today] or [Me] in the formula, it will throw an error message, "Calculated columns cannot contain volatile functions like Today and Me."
You can solve the above issue by following the below steps:

  1. Create a dummy column with name "Today". Data type can be anything.
  2. Create a new calculated column with name whatever u want(for ex.,"TodaysDate").In the formula select the column "Today".(i.e. Formula should be "=[Today]").
  3. Specify the data type of the above column as "Date and Time".
  4. Go to the column you created first(i.e. Today)in the list settings and click on it. Click on the button "Delete".
  5. Add the calculated column you created("TodaysDate") to the view and you can see the current date displayed there.

Categories: MOSS | WSS
Posted by admin on Sunday, March 15, 2009 11:00 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Total Calculated Columns

JQuery for Everyone: Total Calculated Columns

[code:js]

<script type="text/javascript" src="http://airbiz/_layouts/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
    var colmns = new Array("Cr_x0020_Amount");
   
    function addCommas(nStr)
    {
        nStr += '';
        x = nStr.split('.');
        x1 = x[0];
        x2 = x.length > 1 ? '.' + x[1] : '';
        var rgx = /(\d+)(\d{3})/;
        while (rgx.test(x1))
        {
            x1 = x1.replace(rgx, '$1' + ',' + '$2');
        }
        return x1 + x2;
    }   

    /*array for groups based on cellIndex*/
    function getArrayList(varIndex, groupName)
    {
        return $("#tbod"+groupName+"> tr").find(">td:eq(" + varIndex+ ")").get();
    }

    function getArrayForOutput(varIndex, groupName)
    {
        return $("#aggr"+groupName+"> tr:first> td:eq(" + varIndex + ")");
    }

    function CalcGroupPerColumn(groupName,varIndex,gn,n)
    {
        var x = 0;
        var m = "";
        var p1 = "";
        var p2 = "";
        if (groupName == '')
        {
            $("table.ms-listviewtable:first> tbody:eq(2)").attr("id","tbod");
        }

        var arrayList = getArrayList(varIndex,groupName);
        $.each(arrayList, function(i,e)
        {
            x += Number($(e).text().replace(/\$|,|\)/g, "").replace(/\(/g,"-"));
            if ($(e).text().indexOf("$") >= 0)
            {
                m = "$"
            };
        });
  
        /*format for negative numbers*/
        if (x < 0)
        {
            p1 = "(";
            p2 = ")";
            x = Math.abs(x);
        }
       
        var _t=$('#diidSort'+n).text();

        var aggEl = getArrayForOutput(varIndex,groupName);
        if (arrayList.length > 0)
        {
            aggEl
                .css("text-align","right")
                .html("<b>" + _t +" = "+p1+m+addCommas(x.toFixed(2))+p2+"</b>");
        }
       
        var countColumn = $("#aggr"+groupName+"> tr:first").find(".ms-vb").get();
        $.each(countColumn,function(i,e)
        {
            /*$(e).text($(e).text().replace("Count =", gn + " : ") + " no(s)");*/
            $(e).text("");
        });
       
    }   
   
    function getCellIndex(elId)
    {
        var myColumn = $(elId);
        var myParent = myColumn.parents('th');
        var result = myParent.attr("cellIndex");
        return result;
    }
    /*sums money in specific list column*/
    function CalcGroup(groupName,gn)
    {
        $.each(colmns, function(i, n){
            var _CellIndex = getCellIndex('#diidSort' + n);
            CalcGroupPerColumn(groupName,_CellIndex,gn,n);           
        });
    }
    /*BASE*/
    $(function() {
        /*alert('initialization');*/
        var arrayGroup = $("[id*=titl]").get();
        var arrayGroupName = $("[id*=titl]").get();
        $.each(arrayGroup,function(i,e)
        {
            arrayGroup[i]=e.id.replace("titl","");
            arrayGroupName[i]=$(e).find("a").eq(2).text();
            CalcGroup(arrayGroup[i]+"_",arrayGroupName[i]);
        });

        $.each(colmns, function(i, n)
        {
            var xTotal = 0;
            var m = "";
            var _CellIndex = getCellIndex('#diidSort' + n);       
            var arrayIIGroup = $("[id*=aggr]").get();
            var re = new RegExp("^aggr1-(\\d)__", "g");
            var _t=$('#diidSort'+n).text();
            $.each(arrayIIGroup,function(i,e)
            {

                if ($(e).attr("id").match(re))
                {
                    var x = 0;
                    var p1 = "";
                    var p2 = "";
                    var arrayIGroup = $("[id*=" + $(e).attr("id").replace("__","") + "]").get();
                    $.each(arrayIGroup,function(i,ee)
                    {
                        if($(e).attr("id")!=$(ee).attr("id"))
                        {
                            var e = $("#" + $(ee).attr("id") + "> tr:first> td:eq(" + _CellIndex + ")");
                            var e_val = $(ee).text().substring($(ee).text().indexOf('=')+1);
                            x += Number(e_val.replace(/\$|,|\)/g, "").replace(/\(/g,"-"));
                            if (e_val.indexOf("$") >= 0)
                            {
                                m = "$"
                            };
                        }
                    });
                    xTotal+= x;

                    if (x < 0)
                    {
                        p1 = "(";
                        p2 = ")";
                        x = Math.abs(x);
                    }
                    /*x = p1+m+addCommas(x.toFixed(2))+p2;*/
           
                   
                    var aggEl = $("#"+ $(e).attr("id") + "> tr:first> td:eq(" + _CellIndex + ")");
                    aggEl
                        .css("text-align","right")
                        .html("<b>" + _t +" = "+p1+m+addCommas(x.toFixed(2))+p2+"</b>");
                   
                }
            });
           
            if (xTotal < 0)
            {
                p1 = "(";
                p2 = ")";
                xTotal = Math.abs(xTotal);
            }
            else
            {
                p1 = "";
                p2 = "";           
            }
           
            var aggEl = $("#aggr> tr:first> td:eq(" + _CellIndex + ")");
            aggEl
                .css("text-align","right")
                .html("<b>" + _t +" = "+p1+m+addCommas(xTotal.toFixed(2))+p2+"</b>");
           
        });


       
    });
</script>

[/code]

 

Updated : 3rd May 2009

[code:js]

<script type="text/javascript" src="http://airbiz/_layouts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" lang="javascript">
        var colmns = new Array("Net_x0020_Amount","Cr_x0020_Amount","Dr_x0020_Amount");
   
    function addCommas(nStr)
    {
        nStr += '';
        x = nStr.split('.');
        x1 = x[0];
        x2 = x.length > 1 ? '.' + x[1] : '';
        var rgx = /(\d+)(\d{3})/;
        while (rgx.test(x1))
        {
            x1 = x1.replace(rgx, '$1' + ',' + '$2');
        }
        return x1 + x2;
    }   

    /*array for groups based on cellIndex*/
    function getArrayList(varIndex, groupName)
    {
        return $("#tbod"+groupName+"> tr").find(">td:eq(" + varIndex+ ")").get();
    }

    function getArrayForOutput(varIndex, groupName)
    {
        return $("#aggr"+groupName+"> tr:first> td:eq(" + varIndex + ")");
    }

    function CalcGroupPerColumn(groupName,varIndex,gn,n)
    {
        var x = 0;
        var m = "";
        var p1 = "";
        var p2 = "";
        if (groupName == '')
        {
            $("table.ms-listviewtable:first> tbody:eq(2)").attr("id","tbod");
        }

        var arrayList = getArrayList(varIndex,groupName);
        $.each(arrayList, function(i,e)
        {
            x += Number($(e).text().replace(/\$|,|\)/g, "").replace(/\(/g,"-"));
            if ($(e).text().indexOf("$") >= 0)
            {
                m = "$"
            };
        });
  
        /*format for negative numbers*/
        if (x < 0)
        {
            p1 = "(";
            p2 = ")";
            x = Math.abs(x);
        }
       
        var _t=$('#diidSort'+n).text().replace(" Amount","");

        var aggEl = getArrayForOutput(varIndex,groupName);
        if (arrayList.length > 0)
        {
            aggEl
                .css("text-align","right")
                .html("<b>" + _t +" = "+p1+m+addCommas(x.toFixed(2))+p2+"</b>");
        }
       
        var countColumn = $("#aggr"+groupName+"> tr:first").find(".ms-vb").get();
        $.each(countColumn,function(i,e)
        {
            /*$(e).text($(e).text().replace("Count =", gn + " : ") + " no(s)");*/
            $(e).text("");
        });
       
        /*renderHeader(varIndex,_t,xTotal,m);*/
    }   
   
    function getCellIndex(elId)
    {
        var myColumn = $(elId);
        var myParent = myColumn.parents('th');
        var result = myParent.attr("cellIndex");
        return result;
    }
    /*sums money in specific list column*/
    function CalcGroup(groupName,gn)
    {
        $.each(colmns, function(i, n){
            var _CellIndex = getCellIndex('#diidSort' + n);
            CalcGroupPerColumn(groupName,_CellIndex,gn,n);           
        });
    }
    /*BASE*/
    $(function() {
        /*alert('initialization');*/
        var arrayGroup = $("[id*=titl]").get();
        var arrayGroupName = $("[id*=titl]").get();
        $.each(arrayGroup,function(i,e)
        {
            arrayGroup[i]=e.id.replace("titl","");
            arrayGroupName[i]=$(e).find("a").eq(2).text();
            CalcGroup(arrayGroup[i]+"_",arrayGroupName[i]);
        });

                $.each(colmns, function(i, n)
        {
            var xTotal = 0;
            var m = "";
            var _CellIndex = getCellIndex('#diidSort' + n);       
            var _t=$('#diidSort'+n).text().replace(" Amount","");
            $("[id]").filter(function(){return this.id.match(/aggr1-\d*\d__/);}).each(function(i,e)
            {
                var aggEl = $("#"+ $(e).attr("id") + "> tr:first> td:eq(" + _CellIndex + ")");
                if(aggEl.html().length==0)
                {
                    var x = 0;
                    var p1 = "";
                    var p2 = "";
                    $("[id]").filter(function(){return this.id.match(new RegExp("^" + $(e).attr("id").replace("__","_") + "\\d*\\d__", "g"));}).each(function(j,ee)
                    {
                        var ie = $("#" + $(ee).attr("id") + "> tr:first> td:eq(" + _CellIndex + ")");
                        var e_val = $(ie).text().substring($(ie).text().indexOf('=')+1);

                        x += Number(e_val.replace(/\$|,|\)/g, "").replace(/\(/g,"-"));
                        if (e_val.indexOf("$") >= 0)
                        {
                            m = "$"
                        }
                           
                    });
                   
                    xTotal+= x;

                    if (x < 0)
                    {
                        p1 = "(";
                        p2 = ")";
                        x = Math.abs(x);
                    }
                    /*x = p1+m+addCommas(x.toFixed(2))+p2;*/
           
                   
                    aggEl
                        .css("text-align","right")
                        .html("<b>" + _t +" = "+p1+m+addCommas(x.toFixed(2))+p2+"</b>");                   
                }
                else
                {
                    var e_val = aggEl.text().substring(aggEl.text().indexOf('=')+1);
                    xTotal+= Number(e_val.replace(/\$|,|\)/g, "").replace(/\(/g,"-"));
                }
            });
           
            if (xTotal < 0)
            {
                p1 = "(";
                p2 = ")";
                xTotal = Math.abs(xTotal);
            }
            else
            {
                p1 = "";
                p2 = "";           
            }
            /*x = p1+m+addCommas(x.toFixed(2))+p2;*/
           
            var aggEl = $("#aggr> tr:first> td:eq(" + _CellIndex + ")");
            aggEl
                .css("text-align","right")
                .html("<b>" + _t +" = "+p1+m+addCommas(xTotal.toFixed(2))+p2+"</b>");           
           
        });

    });
</script>

[/code]


Categories: JQuery | MOSS | WSS
Posted by admin on Sunday, March 15, 2009 10:54 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Creating a multi-column search form in SharePoint v3 with SharePoint Designer

http://parkesy.wordpress.com/2008/10/31/creating-a-multi-column-search-form-in-sharepoint-v3-with-sharepoint-designer/


Categories: MOSS | SharePoint Designer | WSS
Posted by admin on Thursday, February 19, 2009 5:06 PM
Permalink | Comments (0) | Post RSSRSS comment feed

MOSS 2007 vs. WSS 3.0

http://www.milesconsultingcorp.com/SharePoint-Portal-2007-Version-Comparison-between-MOSS2007-and-WSS3.aspx

http://www.andrewconnell.com/blog/archive/2006/10/18/4910.aspx

http://www.sharepointprovider.com/moss-hosting/compare-wss-moss.asp

 

WSS 3.0 and MOSS 2007 are both powerful collaboration tools made available by Microsoft. Built on the .net platform, many businesses today rely heavily on either one or both products to communicate, collaborate, and share critical business information to contribute information and make decisions based on the most up to date information.   The most basic difference between the two solutions is the upfront investment. In short, WSS is free to most companies whereas MOSS requires a minimum of software purchases and sometimes requires a hardware purchase.

Windows SharePoint Services 3.0 (WSS) ships bundled with the purchase of Windows Server 2003 or Microsoft Small Business Server 2003. This allows organizations to quickly implement WSS and setup an internal company web. The creation of sites and spaces is easy and once the underlying foundation is set up, requires little if no assistance from an organization’s IT team.   Microsoft Office SharePoint Server 2007 (MOSS 2007) takes the collaborative foundation of WSS to another level. With an additional software investment, MOSS 2007 allows organizations to take the foundation laid by WSS v3.0 and expand on it. Additional features sit on top of WSS, use the core WSS framework, and extend it in such a way that is beneficial to larger companies, enterprise deployments, and portal scenarios. Below is a short list of key differentiating features and functions inherent to MOSS 2007.

 

 

 

 

Windows SharePoint Services v3 Features:

33 Features in WSS v3

  • AdminLinks
  • AnnouncementsList
  • BasicWebParts
  • ContactsList
  • ContentLightup
  • ContentTypeSettings
  • ctypes
  • CustomList
  • DataSourceLibrary
  • DiscussionsList
  • DocumentLibrary
  • EventsList
  • fields
  • GanttTasksList
  • GridList
  • IssuesList
  • IssueTrackingWorkflow
  • LinksList
  • MobilityRedirect
  • NoCodeWorkflowLibrary
  • PictureLibrary
  • SiteSettings
  • SPSearchFeature
  • SurveysList
  • TasksList
  • TeamCollab
  • UpgradeLinks
  • WebPageLibrary
  • WikiWelcome
  • WorkflowHistoryList
  • WorkflowProcessList
  • XmlFormLibrary

Microsoft Office SharePoint Services 2007 Features:

107 Features Added in MOSS 2007*

  • AddDashboard
  • Analytics
  • AnalyticsLinks
  • BaseSite
  • BaseSiteStapling
  • BaseWeb
  • BaseWebApplication
  • BDCAdminUILinks
  • BDR
  • BizAppsCTypes
  • BizAppsFields
  • BizAppsListTemplates
  • BizAppsSiteTemplates
  • BulkWorkflow
  • BulkWorkflowTimerJob
  • DataConnectionLibrary
  • DataConnectionLibraryStapling
  • DeploymentLinks
  • DMContentTypeSettings
  • EawfSite
  • EawfWeb
  • EnhancedHtmlEditing
  • ExcelServer
  • ExcelServerSite
  • ExcelServerWebApplication
  • ExpirationWorkflow
  • FeaturePushdown
  • GlobalWebParts
  • GradualUpgrade
  • Hold
  • ipfsAdminLinks
  • IPFSAdminWeb
  • IPFSDocumentConversion
  • IPFSSiteFeatures
  • IPFSWebFeatures
  • LegacyDocumentLibrary
  • ListTargeting
  • LocalSiteDirectoryControl
  • LocalSiteDirectoryMetaData
  • LocalSiteDirectorySettingsLink
  • MasterSiteDirectoryControl
  • MigrationLinks
  • MySite
  • MySiteBlog
  • MySiteCleanup
  • MySiteHost
  • MySiteLayouts
  • MySiteNavigation
  • MySiteQuickLaunch
  • Navigation
  • NavigationProperties
  • OffWFCommon
  • OSearchBasicFeature
  • OSearchCentralAdminLinks
  • OSearchEnhancedFeature
  • OSearchPortalAdminLinks
  • OSearchSRPAdminLinks
  • OsrvLinks
  • OsrvTasks
  • OssNavigation
  • OSSSearchSearchCenterUrlFeature
  • OSSSearchSearchCenterUrlSiteFeature
  • PageConverters
  • PortalLayouts
  • PremiumRootSite
  • PremiumRootSiteStapling
  • PremiumSite
  • PremiumSiteStapling
  • PremiumWeb
  • PremiumWebApplication
  • ProfileSynch
  • Publishing
  • PublishingLayouts
  • PublishingPrerequisites
  • PublishingResources
  • PublishingSite
  • PublishingStapling
  • PublishingWeb
  • RecordsManagement
  • RedirectPageContentTypeBinding
  • RelatedLinksScopeSettingsLink
  • ReportCenterCreation
  • ReportCenterSampleData
  • Reporting
  • ReportListTemplate
  • ReviewWorkflows
  • SearchAndProcess
  • SearchWebParts
  • SharedServices
  • SignaturesWorkflow
  • SitesList
  • SkuUpgradeLinks
  • SlideLibrary
  • SlideLibraryActivation
  • SpellChecking
  • SPSDisco
  • SpsSsoLinks
  • SRPProfileAdmin
  • StapledWorkflows
  • TranslationWorkflow
  • TransMgmtFunc
  • TransMgmtLib
  • UpgradeOnlyFile
  • UserMigrator
  • ViewFormPagesLockDown
  • WebPartAdderGroups


Categories: MOSS | WSS
Posted by admin on Monday, February 16, 2009 8:52 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Insert a Sharepoint list item from web services

Wanted to use Sharepoint's web services to manipulate a list on one of our WSS sites. 
Then submit a list item from a remote location, so using the Lists web service (http://<server-url>/_vti_bin/lists.asmx) seemed to make sense.

Basically, what you submit to the web service is a xml document that contains the values for the list fields that you want to add, something like this (lifted and modified from here):

string sBatch = string.Empty;
sBatch = “<Method ID=\"1\" Cmd=\"New\">";
sBatch += “<Field Name=\"ID\">New</Field>";
sBatch += “<Field Name=\"Title\">My Title</Field>";
sBatch += “<Field Name=\"EventDate\">" + DateTime.Now + “</Field>";
sBatch += “</Method>";


This is one way to construct the xml document that you need to submit. This xml will add an item with a title of 'My Title' and an Event Date of the current date/time.  This code works, theres nothing wrong with it.  Its just that this is the extent of the examples out there, I couldn't find anything that was more complex, for instance, an example of inserting an item into a Sharepoint list where one of the fields in the list is a lookup to another Sharepoint list.

Consider a list where there is a Status column, which is a lookup to another list that has possible values of 'Submitted', 'Approved', 'Rejected', and 'Completed'.  How do you specify the value for this field? I initially tried simply inserting the text value of what I wanted, so my xml would look like this:

<Method ID="1″ Cmd="New">
     <Field Name="ID">New</Field>
     <Field Name="Title">My Title</Field>
     <Field Name="EventDate">3/25/2006 12:00 PM</Field>
     <Field Name="Status">Submitted</Field>
</Method>

But this doesn't work.  After some more trial and error, I tried the index of the value that I wanted, in this case 0, because 'Submitted' is the first item in the list, and presto! My item was inserted, all was good.  The downside that I see to this, is that if the indices of the items change, you have to change your xml. You could get around this by querying the lookup list and finding the index of the item dynamically each time, its your call.  So if you want to insert an item into Sharepoint with a field that is a lookup field, here is an example of what your xml should look like:

<Method ID="1″ Cmd="New">
     <Field Name="ID">New</Field>
     <Field Name="Title">My Title</Field>
     <Field Name="EventDate">3/25/2006 12:00 PM</Field>
     <Field Name="Status" Type="Lookup">0</Field>
</Method>

thanks Ben Reichelt’s Weblog


Categories: MOSS | VS 2005 | WSS
Posted by admin on Thursday, February 05, 2009 11:58 AM
Permalink | Comments (0) | Post RSSRSS comment feed