Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Check if Folder is available

$
0
0

Hi,

I have written below code to check if the folder exists in the site.

Through folder is available still it is displaying as 'Folder does not exists'.

Please check if i am making any mistake here

                               

using Sy

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

using Microsoft.SharePoint;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("http://servername:1268/sites/sitecoll/WikiSite/"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    if (web.GetFolder("General").Exists)
                    {
                        Console.WriteLine("Folder exists");
                    }
                    else
                    {
                        Console.WriteLine("Folder does not exists");
                    }
                    Console.ReadLine();
                }
            }
        }


    }
}

Regards,

Sudheer


Thanks & Regards, Sudheer



Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>