EzDevInfo.com

sharepoint interview questions

Top sharepoint frequently asked interview questions

SharePoint for a C# ASP.NET Developer [closed]

I've been asked to create a website in SharePoint within the next couple of weeks or so and I'm entirely new to SharePoint.

Does anyone have any good examples/tutorials on how to do some basic operations such as creating custom forms, using basic CRUD operations, with a custom SQL Server database?

Also is there any way to code in ASP.NET (with code-behind pages), but use the SharePoint look and feel and authentication stuff?


Source: (StackOverflow)

What is the purpose of zones in sharepoint? (web application zones or authentication zones or how do they call it)

I can't understand the concept and, first of all, where it belongs. Is it solely a Shrepoint concept or more general like of ASP.NET or IIS level? Does it only affect authentication and if so how does it affect it? Or what effect does it have on an application? I know it is a broad question, but I've googled for about 15 minutes and haven't been able to find the answer. And it is kind a not so critical for me now but I'm curious.

Can you please give a link to a resource with an explanation of this? Thanks!

@Edit: I mean zones like in Authentication Provider : Forms Zone : Intranet (Internet, Default)

@Edit: From what I've understood by now the zones have to do with the association of IIS web applications with sharepoint web applications, and with site collections for that matter. So for example you can extend a web application creating a new IIS web application but from sharepoint's point of view it is just another URL pointing to the same web application with the same set of site collections. And the extension IIS web application can have a different sharepoint zone associeted with it (or thay can be the same zone) providing a way to use a different authentication methods for different access points of the same sharepoint application.

Am I right here?


Source: (StackOverflow)

Advertisements

Must Have SharePoint dev tools [closed]

I have only been doing development work in SharePoint the last 6 months. Coming from a client server background the tooling situation in SharePoint was a rude surprise, but I think that I have by now picked up the majority of the Must Have tools.

Which tools should be in every SharePoint developers toolbox in your opinion ?

My list so far includes:


Source: (StackOverflow)

Sharepoint web services -- The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was 'NTLM'

I know there's a lot of questions on SO similar to this, but I couldn't find one for this particular issue.

A couple of points, first:

  • I have no control over our Sharepoint server. I cannot tweak any IIS settings.
  • I believe our IIS server version is IIS 7.0.
  • Our Sharepoint Server is anticipating requests via NTLM.
  • Our Sharepoint Server is on the same domain as my client computer.
  • I am using .NET Framework 3.5, Visual Studio 2008

I am trying to write a simple console app to manipulate Sharepoint data using Sharepoint Web Services. I have added the Service Reference, and the following is my app.config:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="ListsSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
                receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="Transport">
                    <transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm" />
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="https://subdomain.companysite.com/subsite/_vti_bin/Lists.asmx"
            binding="basicHttpBinding" bindingConfiguration="ListsSoap"
            contract="ServiceReference1.ListsSoap" name="ListsSoap" />
    </client>
</system.serviceModel>

This is my code:

static void Main(string[] args)
{
    using (var client = new ListsSoapClient())
    {
        client.ClientCredentials.Windows.ClientCredential = new NetworkCredential("username", "password", "domain");
        client.GetListCollection();
    }
}

When I call GetListCollection(), the following MessageSecurityException gets thrown:

The HTTP request is unauthorized with client authentication scheme 'Ntlm'.
The authentication header received from the server was 'NTLM'.

With an inner WebException:

"The remote server returned an error: (401) Unauthorized."

I've tried various bindings and various code tweaks to try to authenticate properly, but to no avail. I'll list those below.


I've tried the following steps:

Using a native Win32 Impersonator before creating the client

using (new Impersonator.Impersonator("username", "password", "domain"))
using (var client = new ListsSoapClient())
{
    client.ClientCredentials.Windows.ClientCredential = new NetworkCredential("dpincas", "password", "domain");
    client.GetListCollection();
}

This produced the same error message.


Setting TokenImpersonationLevel for my client credentials

using (var client = new ListsSoapClient())
{
    client.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;
    client.GetListCollection();
}

This produced the same error message.


Using security mode=TransportCredentialOnly

<security mode="TransportCredentialOnly">
    <transport clientCredentialType="Ntlm" />
</security>

This resulted in a different error message:

The provided URI scheme 'https' is invalid; expected 'http'.
Parameter name: via

However, I need to use https, so I cannot change my URI scheme.


I've tried some other combinations that I can't remember, but I'll post them when I do. I'm really at wits end here. I see a lot of links on Google that say "switch to Kerberos", but my server seems to only be accepting NTLM, not "Negotiate" (as it would say if it was looking for Kerberos), so that is unfortunately not an option.

Any help out there, folks?


Source: (StackOverflow)

Any good (open-source) alternative to SharePoint? [closed]

We are a small company and would like to have a Content & Doc management features (such as version control, custom lists, workflow, alerts, feeds, blogs, wikis, forums, good integrated search) which are most commonly found in SharePoint. But we cannot use SharePoint due to its cost, complexity, and high maintenance.

Search feature which supports most common doc formats (e.g. pdf, MS Office & Open Office file formats) is crucial since we have a lot of legacy stuff in these formats & we need to give ourselves one place from where we can organize & search all our content.

Please suggest alternatives to SharePoint.


Source: (StackOverflow)

How good/bad is sharepoint programming? [closed]

I got a job offer today for a position as a SharePoint developer. One of my friends is telling me that sharepoint is a big mess and not something I would want to be doing.

What are some of your experiences/thoughts in working with SharePoint?


Source: (StackOverflow)

Sharepoint Wikis

Ok, I've seen a few posts that mention a few other posts about not using SP wikis because they suck.

Since we are looking at doing our wiki in SP, I need to know why we shouldn't do it for a group of 6 automation-developers to document the steps in various automated processes and the changes that have to be made from time to time.


Source: (StackOverflow)

CAML query with nested AND's and OR's for multiple fields

I am working on proof-of-concept code to dynamically generate CAML based on keywords provided to a highly-specific search web service that I am writing. I am not using the SharePoint-provided search web service for this proof. I have done so already for what I am trying to achieve. From all of my research, I cannot find a close example for what I am trying to achieve, which is to check multiple fields for multiple values. Yes, I have looked on SO already for my answer, including this one: Need help on building CAML Query.

With that said, if it is possible, how can the following SQL-like query be written in CAML?

SELECT FirstName, LastName, Description, Profile
FROM SomeFakeTable
WHERE (FirstName = 'John' OR LastName = 'John' OR Description = 'John' OR Profile='John')
  AND (FirstName = 'Doe' OR LastName = 'Doe' OR Description = 'Doe' OR Profile='Doe')
  AND (FirstName = '123' OR LastName = '123' OR Description = '123' OR Profile='123')

Source: (StackOverflow)

How is SharePoint perceived in your company? [closed]

UPDATE An interesting time to revisit this question. Is perception still the same now that SharePoint 2010 is beginning to take hold? Certainly implementing 2010 is not without its own challenges, but is business perception one of them?

UPDATE: Our implementation is now kicking into high gear with some high profile projets going live in the coming weeks, so I am quite interested to see if the environment has changed out there.

Original Question

We have an issue within our working environment where the perception of SharePoint is either:

a) The golden bullet, the answer to all our problems.

b) An application which either does or does not solve a specific problem.

c) A frustrating tool which does not deliver their exacting requirements.

Now in my opinion SharePoint (or more specifically in our case Microsoft Office SharePoint Server 2007) is a framework on top of various lower level Microsoft technologies (IIS, ASP.Net, WSS 3.0, .Net Framework, Windows Workflow Foundation amongst others) and as such can be developed to do most anything (given time and resources).

The attitudes that have been formed in my organisation (and others I'm sure) is a combination of the Microsoft Marketing Machine and an organisaton's desire to get the 'golden bullet' in front of as many people as possible wihtout saying 'What for?' or 'Why?' or in some cases even 'How?'

Is this an attitude and perception shared by other SharePoint devs?


Source: (StackOverflow)

Best way to resolve file path too long exception

I created a app that downloads all document libraries in a SP Site , but at one point it giving me this error (I tried looking at google but couldn;t find anything, now if anyone knows any trick to solve this problem please respond otherwise thanks for looking at it)

System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck) at System.IO.Path.GetFullPathInternal(String path) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at System.IO.File.Create(String path)

it reaches the limit for string, Code is given below,

#region Downloading Schemes

    private void btnDownload_Click(object sender, EventArgs e)
    {
        TreeNode currentNode = tvWebs.SelectedNode;
        SPObjectData objectData = (SPObjectData)currentNode.Tag;
        try
        {
            CreateLoggingFile();
            using (SPWeb TopLevelWeb = objectData.Web)
            {
                if(TopLevelWeb != null)
                    dwnEachWeb(TopLevelWeb, TopLevelWeb.Title, tbDirectory.Text);
            }
        }
        catch (Exception ex)
        {
            Trace.WriteLine(string.Format("Exception caught when tried to pass TopLevelWeb:{1}, Title = {2}, object data to (dwnEachWeb_method), Exception: {0}", ex.ToString(), objectData.Web, objectData.Title));
        }
        finally
        {
            CloseLoggingFile();
        }
    }

    private void dwnEachWeb(SPWeb TopLevelWeb, string FolderName, string CurrentDirectory)
    {
        if (TopLevelWeb != null)
        {
            if (TopLevelWeb.Webs != null)
            {
                CurrentDirectory = CurrentDirectory + "\\" + TopLevelWeb.Title;
                CreateFolder(CurrentDirectory);
                foreach (SPWeb ChildWeb in TopLevelWeb.Webs)
                {

                    dwnEachWeb(ChildWeb, ChildWeb.Title, CurrentDirectory);
                    ChildWeb.Dispose();
                }
                dwnEachList(TopLevelWeb, CurrentDirectory);
                //dwnEachList(TopLevelWeb, FolderName, CurrentDirectory);
            }
        }
    }

    private void dwnEachList(SPWeb oWeb, string CurrentDirectory)
    {
        foreach (SPList oList in oWeb.Lists)
        {
            if (oList is SPDocumentLibrary && !oList.Hidden)
            {
                dwnEachFile(oList.RootFolder, CurrentDirectory);
            }
        }
    }

    private void dwnEachFile(SPFolder oFolder, string CurrentDirectory)
    {
        if (oFolder.Files.Count != 0)
        {
            CurrentDirectory = CurrentDirectory + "\\" + oFolder.Name;
            CreateFolder(CurrentDirectory);
            foreach (SPFile ofile in oFolder.Files)
            {
                if (CreateDirectoryStructure(CurrentDirectory, ofile.Url))
                {
                    var filepath = System.IO.Path.Combine(CurrentDirectory, ofile.Url);
                    byte[] binFile = ofile.OpenBinary();
                    System.IO.FileStream fstream = System.IO.File.Create(filepath);
                    fstream.Write(binFile, 0, binFile.Length);
                    fstream.Close();
                }
            }
        }
    }

    //creating directory where files will be download        
    private bool CreateDirectoryStructure(string baseFolder, string filepath)
    {
        if (!Directory.Exists(baseFolder)) return false;

        var paths = filepath.Split('/');

        for (var i = 0; i < paths.Length - 1; i++)
        {
            baseFolder = System.IO.Path.Combine(baseFolder, paths[i]);
            Directory.CreateDirectory(baseFolder);
        }
        return true;
    }

    //creating folders
    private bool CreateFolder(string CurrentDirectory)
    {
        if (!Directory.Exists(CurrentDirectory))
        {
            Directory.CreateDirectory(CurrentDirectory);
        }
        return true;
    }

    //shorting string

    #endregion

Source: (StackOverflow)

Powershell Error "The term 'Get-SPWeb' is not recognized as the name of a cmdlet, function..."

I just typed the follow to try and get my SharePoint site:

$spWeb = Get-SPWeb -Identity "http://nycs00058260/sites/usitp"

It gave me the following error

The term 'Get-SPWeb' is not recognized as the name of a cmdlet, function, script...

The url is correct so why am I getting this error?


Source: (StackOverflow)

Auto number column in SharePoint list

In a SharePoint list I want an auto number column that as I add to the list gets incremented. How best can I go about this?


Source: (StackOverflow)

How bad is it to not dispose() in Powershell?

Sometimes we need to perform small administrative tasks in SharePoint. A simple PowerShell script is a really good tool for that. For instance, such script can enumerate event handlers of a list:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$site = new-object Microsoft.SharePoint.SPSite($args[0])   
$site.RootWeb.Lists["MyList"].EventReceivers > C:\MyListHandlers.txt

It's known that objects like SPSite and SPWeb have to be Dispose()-d after a call, otherwise memory leaks occur. The best would be to call

$site.RootWeb.dispose()
$site.dispose()

at the end of this script. But if this is a Powershell script which will only be run once, and we know that PowerShell cleans up after execution - is it so bad to not call dispose()?

So, my question is - is there some danger if sometimes I run scripts like this; will it affect the overall stability of SharePoint farm (or of the server on which I'm running the script)?


Source: (StackOverflow)

How can I include value of sharepoint's version column in a word document?

I'm trying to work out a way to display the contents of the version column from SharePoint (i.e. the value that changes every time a file is checked in) as a field (or something similar) inside of a Word document.

Ideally, I'd like to know how to configure SharePoint so I could click something like "Insert > Quick Parts > Document Property > Version", and it would include the version in the document. The goal is to make it easier for someone to correlate a printed version of a document with the version history of SharePoint.

I have been able to add editable text columns to the Document content-type and have them show up as document property quick parts. I've also been able to add a calculated column which gets the version as a text string... however this calculated column isn't showing up in Word as a document property. (Perhaps I'm missing a setting on the calculated column)


Source: (StackOverflow)

Serialization in C# without using file system

I have a simple 2D array of strings and I would like to stuff it into an SPFieldMultiLineText in MOSS. This maps to an ntext database field.

I know I can serialize to XML and store to the file system, but I would like to serialize without touching the filesystem.

public override void ItemAdding(SPItemEventProperties properties)
{
    // build the array
    List<List<string>> matrix = new List<List<string>>();
    /*
    * populating the array is snipped, works fine
    */
    // now stick this matrix into the field in my list item
    properties.AfterProperties["myNoteField"] = matrix; // throws an error
}

Looks like I should be able to do something like this:

XmlSerializer s = new XmlSerializer(typeof(List<List<string>>));
properties.AfterProperties["myNoteField"] = s.Serialize.ToString();

but that doesn't work. All the examples I've found demonstrate writing to a text file.


Source: (StackOverflow)