Interactive stsadm help

Filed Under (MOSS, SharePoint, SharePoint administration) by Boris Gomiunik on 07-06-2009

At TehNet they’ve released a very nice silverlight interactive help for STSADM command which the SharePoint Admin almost can’t imagine living without.

Straight to the point:

stsadm for MOSS 2007
http://technet.microsoft.com/en-us/office/sharepointserver/cc948709.aspx

stsadm for WSS
http://technet.microsoft.com/en-us/windowsserver/sharepoint/dd418924.aspx

Limiting the People picker and profile import from AD to certain group

Filed Under (MOSS, SharePoint, SharePoint administration) by Boris Gomiunik on 02-06-2009

If you have a SharePoint environment which not every employee in the organization uses you’re stuck with two obsticles:

  1. How to limit that the person is not selected and/or added as a member of the site collection (because of licencing issues)
  2. How to stop MOSS from importing entire AD domain or forest. If you’re stuck with 100 users from 1000 to enter information manually can be a pain.

The solution can be that SharePoint will not recognize other domains/forests than the ones specified and limit the people from those forests to only certain groups.

Here’s what I did. Let’s say we have an AD domain called contosio.local. In this domain We’ve created OU called AccessGroups and in this OU we’ve created a security group called SharePoint. We want to do this for the site http://moss

1. To limit People picker to certain group in AD domain
a. limit the peoplepicker property only to specified domain by running the following command
stsadm –o setproperty –pn "peoplepicker-searchadforests” –pv “domain:contosio.local,contosio\administrator,adminPassword” –url http://moss

Note in the example above you have to enter the account with the right to read from AD and its password. If you want to limit the access to multiple AD domains, separate the values in pv with semicolon.

b. limit the peoplepicker property to custom LDAP filter by running the following command:
stsadm –o setproperty –pn peoplepicker-searchadcustomfilter –pv “(memberOf=CN=SharePoint,OU=AccessGroups,DC=contosio,DC=local)” –url http://moss

Now you’ll be able to add people only from the domain contosio.local – group SharePoint. Don’t forget to add users to security group.

2. To limit profile import only to that same AD group (MOSS ONLY)
a. Open SharePoint Central Administration
b. Open Shared Services Administration
c. Click User Profiles and Properties
d. Click View Import Connections
e. Edit the domain connection for the domain (if you don’t have one yet, you’ll have to create it manually)
f. Change the default value of the field  User filter from (&(objectCategory=Person)(objectClass=User)) to
(&(objectCategory=Person)(objectClass=User)(memberOf=CN=SharePoint,OU=AccessGroups,DC=contosio,DC=local))

Like that you now control from AD who can access SharePoint and who’s profiles get imported.

Fixing / Reattaching / Changing the Lookup list

Filed Under (MOSS, SharePoint, SharePoint administration) by Boris Gomiunik on 19-05-2009

Today the strangest thing happened. During the content migration suddenly the target list lost the proper destination. The result was ALL the lookup values missing and the dropdown empty when adding /editing. Horror! if this would have been a short list the first thing I’d do is to restore it from backup and recover the lookup values. But this being the couple-thousand-records-and-growing-daily list I couldn’t afford that.

With a bit of research into Lookup Field Schema XML I’ve discovered that the LookupList and WebID properties (GUIDS) were wrong. Using SharePoint Manager I could correct the WebID but not the LookupList.

Fortunately after a short period of googling around I’ve discovered this post:

Reattaching LookupList Property to a new List

and that worked like a charm! All the values magically reappeared and lookup dropdowns are back in action.

Inserting JavaScript into XSLT

Filed Under (JavaScript, MOSS, SharePoint, XSLT) by Boris Gomiunik on 12-03-2009

When inserting JavaScript code into XSLT dataForm webpart it can sometimes get tricky. Sometimes SharePoint designer messes up our code or we have huge trouble with & signs,… the best way to insert the JavaScript code block into XSLT data view is to enclose it with xsl:text and cdata. Below is the sample:

<xsl:text disable-output-escaping=”yes”>
<![CDATA[
<script type=”text/javascript”>
(your JavaScript code here)
</script>
]]>
</xsl:text>

Filtering by Current user CAML query

Filed Under (JavaScript, MOSS, SharePoint) by Boris Gomiunik on 02-03-2009

If you need custom CAML (for example in Content Query WebPart QueryOverride) and you need items filtered by Current User – the one that is currently logged in, you can setup the following filter (the example below references the field “Assigned To”:

<Where>
  <Eq><FieldRef Name=’AssignedTo’ LookupId=’TRUE’/><Value Type=’Integer’><UserID/></Value></Eq>
</Where>

In the example above what I did was change the value type to Integer and add a LookupId=’TRUE’ attribute to FieldRef node.

How to get the internal name of the field? Here’s one of the ways: In list settings click the name of the column / field for editing its properties

image

in the URL of the “Change Column” page look for the value of last parameter (Field=…)

image

If your column name doesn’t contain any special characters (like spaces or other, you have the value), otherwise you can use simple javascript to retrieve the field name. For example if the column name is Številka, the parameter in url will look weird:

image

To get the field name, copy the value and paste it into the following javascript which you can run from URL in your browser:

javascript:alert(unescape(‘[paste_weird_field_code_here]’))

image

and the alert box shows the SharePoint’s internal column name.

BDC, multiple choices for filters and wildcards

Filed Under (MOSS, SharePoint) by Boris Gomiunik on 19-02-2009

I’ve been looking a lot around to find an option to have multiple filters available on BDC that would not exclude each other out. The scenario is:

  • we have a BDC connection to a SQL table with entity that contains company ID and Company name. Company ID is a primary key. Both ID and name are strings.
  • we would like to filter either by company ID or by company name and use the wildcard option (to search by part of string or whole).

The best way to set up your ADF is with BDC MetaMan.

1. Set up appropriate filters on getdbo method (the Finder method). The FilterDescriptors have to be of type wildcard. Put any value as default.

image

 

2. Build the XML

3. Modify the XML:

a. The Select statement in RdbCommandText property of the finder method (Getdbo.[tableName]) – change the AND operator to OR.
 
Select [companyID],[companyName],[address],… From dbo.[companies] where([companyID] LIKE @CompanyID) OR ([companyName] LIKE @CompanyName)</Property>
(use your column names in the example above).

b. Delete or comment out default values for “In” parameters of that method.
 
<Parameters>
  <Parameter Direction="In" Name="@CompanyID">
    <TypeDescriptor TypeName="System.String" Name="sifra" AssociatedFilter="Šifra" IdentifierName="[companyID]">
     <!–<DefaultValues>
     <DefaultValue MethodInstanceName="dbo.[partnerji]Finder" Type="System.String">123</DefaultValue>
      </DefaultValues>>
     </TypeDescriptor>
</Parameter>

4. Publish the XML. If publishing the xml gives you version error, just increment the version number from 1.0.0.0 to 1.0.0.1

This did the trick for me. Below are the “before” and “after” parts of the code with highlighted changes. Click for a bit enlarged preview.

Code comparison

Technorati Tags: ,,
ads
ads
ads