Udostępnij za pośrednictwem


How to pull the metadata information of a folder in SharePoint Portal server 2001 dashboard through code

In this post we can see how we can pull some metadata information of a folder in a SharePoint portal 2001 dashboard through code. Though, SharePoint portal server 2001 is quite old (Saying Quote: "Old is Gold" J), it is really interesting if we see how it look like and how we can play with it through code.

If you click on the below picture, then you can see how a SharePoint portal dashboard look like !

Untitled

In this post I am going to show we can pull some metadata information of a folder in a SharePoint portal dashboard through code. Unlike Microsoft.SharePoint.dll, in SharePoint portal server 2001, we have to use a COM component which is Interop.PKMCDO. You will get it by, Add Reference à COM tab

untitled

Once you add it into your .NET project, then you can play with your SharePoint portal site. Below code is written .NET windows based application. It will pull out some metadata information of a folder. Remember, in order to get all the values you must have proper rights to access that folder.

 

    1: using System;
    2: using System.Collections.Generic;
    3: using System.ComponentModel;
    4: using System.Data;
    5: using System.Drawing;
    6: using System.Text;
    7: using System.Windows.Forms;
    8: using PKMCDO;
    9: using System.Collections; 
   10:  
   11: namespace MySPS2001Test
   12: {
   13:     public partial class Main : Form
   14:     {
   15:         private PKMCDO.KnowledgeFolderClass KMFolder; 
   16:  
   17:         public Main()
   18:         {
   19:             InitializeComponent();
   20:         }
   21:  
   22:         private void btnStart_Click(object sender, EventArgs e)
   23:         {       
   24:  
   25:             KMFolder = new PKMCDO.KnowledgeFolderClass();
   26:             txtAuthors.Text = String.Empty;
   27:             txtReaders.Text = String.Empty;
   28:             txtApprovers.Text = String.Empty;
   29:             txtCoordinators.Text = String.Empty;
   30:  
   31:             try
   32:             {
   33:                 KMFolder.DataSource.Open("https://blr3b09-1/MySP2001/Dashboards/sowmyan folder/", null, ConnectModeEnum.adModeReadWrite, RecordCreateOptionsEnum.adFailIfNotExists, RecordOpenOptionsEnum.adOpenSource, "", "");
   34:               
   35:  
   36:                 Object[] oAuthors = (Object[])KMFolder.Authors;
   37:                 Object[] oReaders = (Object[])KMFolder.Readers;
   38:                 Object[] oApprovers = (Object[])KMFolder.Approvers;
   39:                 Object[] oCordinators = (Object[])KMFolder.Coordinators;
   40:  
   41:                 txtAuthors.Text = Convert.ToString(authors.Length);
   42:                 txtReaders.Text = Convert.ToString(readers.Length);
   43:                 txtApprovers.Text = Convert.ToString(approvers.Length);
   44:                 txtCoordinators.Text = Convert.ToString(coordinators.Length);
   45:  
   46:             }
   47:  
   48:             catch (Exception ex)
   49:             {
   50:                 MessageBox.Show("Error: " + ex.Message);
   51:             }  
   52:  
   53:         }
   54:  
   55:     }
   56:  
   57: }

SharePoint portal server 2001 SDK documentation: https://msdn.microsoft.com/en-us/library/bb871512.aspx

SharePoint portal server 2001 resources: https://technet.microsoft.com/en-us/office/sharepointserver/bb735843.aspx

Comments