MOSS 2007 / WSS 3 – Configuring Reporting Services

28 January 2010

Just blogging a link to this great set of articles.. .

http://mosshowto.blogspot.com/2009/01/sharepoint-report-server-2008.html



post a comment / view comments   (currently 0 comments)

Sharepoint: FormField Control

09 November 2009

Just discovered this control the other day. It renders sharepoint field types (and custom field types) as they would appear on a sharepoint form. All you need to pass to it it the id of a list and field name.It can also be used generate a form element in edit mode (i,e. with values populated).

using (var site = new SPSite("http://mywebsite"))
{
    using (var web = site.OpenWeb())
    {
        var list = web.Lists[this.ListName];

        foreach (SPField field in list.Fields)
        {
            if (field.FieldRenderingControl != null &&
              !field.Hidden && !field.ReadOnlyField &&
              field.Type != SPFieldType.Attachments)
            {
                var currentField = new FormField();
                currentField.ListId = list.ID;
                currentField.FieldName = field.InternalName;
                currentField.ID = "Control_" + field.InternalName;
                currentField.ControlMode = SPControlMode.New;
                this.Controls.Add(currentField);
            }
        }
    }
}

See this article for a longer explanation / more code!

http://www.fivenumber.com/sharepoint-list-form-generator/



post a comment / view comments   (currently 0 comments)

WSPBuilder: Ensure that GAC’d assemblies are always added to wsp

09 November 2009

GAC’d assemblies are not always included in a wsp build by wspbuilder. See

http://wspbuilder.codeplex.com/Thread/View.aspx?ThreadId=22446.

To counteract this, add the following post build events

ATTRIB -R "$(SolutionDir)[FolderContainingFeatureProject]\GAC\"  /S /D
COPY "$(TargetPath)" "$(SolutionDir) [FolderContainingFeatureProject] \GAC\" /Y



post a comment / view comments   (currently 0 comments)

Using OM to access Lists in another web app / Random Notes

23 October 2009

I had to access a list on a SharePoint web app from another web app on the same farm using code, but experienced a sql exception. The app pool accounts had least privilege, but the accounts of the user had restricted reader rights to both web apps (and app pool account as i tried running with elevated privileges). It turns out that if your executing code against a web app outside of your current context, you need to have rights to the db on the server.

http://blog.krichie.com/2008/09/11/unrestricted-access-via-sharepoint-object-model-from-console-applications/

I ended up reading via webservices and converting to a datatable, similar to the following.

http://politechnosis.kataire.com/2008/09/reading-sharepoint-lists-into-adonet.html

Unrelated, here is a good article on making web.config mods via a feature receiver.

http://weblogs.asp.net/wesleybakker/archive/2009/01/21/web.config-modifications-with-a-sharepoint-feature.aspx

Here is another unrelated article about group policy (something i never fully remember).
http://technet.microsoft.com/en-us/library/cc732593(WS.10).aspx



post a comment / view comments   (currently 0 comments)

C#: What threads are custom controls running in

13 October 2009

Here’s a useful (well maybe) block of code to determine what thread controls are running in.

Note that this code was placed in a base class (hence the 1s on the stack frame to show callers etc).

protected override void CreateChildControls()
{
  var stack = new StackTrace();
  var message = string.Format(
    CultureInfo.InvariantCulture,
    "THREAD ID: {0}, CLASSNAME: {1}, METHOD: {2}",
    Thread.CurrentThread.ManagedThreadId,
    stack.GetFrame(1).GetMethod().ReflectedType.FullName,
    stack.GetFrame(1).GetMethod().Name);
  Debug.WriteLine(message);
}



post a comment / view comments   (currently 0 comments)