Gunnar Peipman's ASP.NET blog

ASP.NET, C#, SharePoint, SQL Server and general software development topics.

Sponsors

News

 
 
 
 
 
Programming Blogs - Blog Catalog Blog Directory
 
 
 

Links

Social

December 2008 - Posts

SharePoint jQuery deployment feature

After reading Jan Tielen's blog entries Integrating SharePoint 2007 and jQuery Part One and Part Two I wrote a simple SharePoint solution on Visual Studio 2008 that installs jQuery scripts to SharePoint.

Features

  • Deploys jQuery standard and minified versions to SharePoint site.
  • Deployment script activates only Packed version, so you don't get three parallel versions of jQuery activated at same time.
  • Features use AdditionalPageHead Delegate control and you don't have to modify any page or master page to get scripts included.

Downloads

Notes

Beofre deployment change the URL of SharePoint site in setup.bat. When using source don't forget to change deployment URL under project properties Build tab.

Licence

There is no licence from me. Feel free to download the source and deployment package and modify these how you like. jQuery is under MIT Lince, so don't break the rules of this licence. Enjoy! :)

Posted: Dec 12 2008, 10:58 PM by DigiMortal | with 9 comment(s)
Filed under:
Access denied error when crawling SharePoint content

One nice day I discovered that MOSS2007 search site didn't work anymore on test server. Well, the only thing that worked was indexing on file system level. But SharePoint content indexing was out of order. I found some information from web about this issue. Specially helpful may be blog entry Access denied when crawling MOSS Content by Sven Gillis. But it was only part of solution.

There was one more trick I didn't know. Indexing started work okay when I enabled NTML authentication on site to be indexed. It has only Basic Authentication enabled before.

I hope this post may help somebody.

Posted: Dec 07 2008, 02:34 PM by DigiMortal | with no comments
Filed under:
Authenticating programmatically to Exchange Server 2003 FBA

In one of my projects I had to read data from Exchange Server 2003 programmatically. I had access to Outlook Web Access that used Form Based Authentication (FBA). After some hacking and testing I got authentication part of my utility work. The point was easy - before making WebDAV requests to Exchange Server we need authentication cookies, so there is active session we can use.

At first let's see namespaces I used in my code to get FBA stuff work.


using System.Text;

using System.Net;

using System.Security.Authentication;

using System.Web;


And here is the authentication method that returns session cookies if authentication succeeded. You can use these cookies if you have to execute WebDAV queries by example.


private CookieCollection DoExchangeFBA(string server, string 
                                       userName, string password)

{

    var uri = server + "/exchweb/bin/auth/owaauth.dll";

 

    var request = (HttpWebRequest)HttpWebRequest.Create(uri);

    request.Method = "POST";

    request.CookieContainer = new CookieContainer();

    request.ContentType = "application/x-www-form-urlencoded";

    request.AllowAutoRedirect = false;

    request.ServicePoint.Expect100Continue = false;

 

    server = HttpUtility.UrlEncode(server);

    userName = HttpUtility.UrlEncode(userName);

    password = HttpUtility.UrlEncode(password);

    var bodyString = "destination={0}&flags=0&username={1}";

    bodyString += "&password={2}&SubmitCreds=Log+On&";

    bodyString += "forcedownlevel=0&trusted=0";

    bodyString = string.Format(bodyString, server,

                                userName, password);

 

    var body = Encoding.ASCII.GetBytes(bodyString);

 

    request.ContentLength = body.Length;

    ServicePointManager.Expect100Continue = false;

 

    var stream = request.GetRequestStream();

    stream.Write(body, 0, body.Length);

    stream.Close();

 

    var response = (HttpWebResponse)request.GetResponse();

    if (response.Cookies.Count < 2) throw

        new AuthenticationException("Failed to login to OWA!");

 

    return response.Cookies;

}


If you are using Exhange Server 2007 then you have different authentication address and you get back only one cookie.

More Posts