Showing posts with label SharePoint. Show all posts
Showing posts with label SharePoint. Show all posts

Wednesday, May 26, 2010

Everyone can access a SharePoint site collection

I created a SharePoint web application months ago, and set “Allow Anonymous” to true. After weeks, I changed my idea and set “Allow Anonymous” to false. But it didn’t work. Everyone still had access to the whole site collection even though their accounts were not in the list of Advanced Permissions.
After worked with Microsoft support guy, we found the solution. There’s a page setanon.aspx in _layouts. Open that page, choose Nothing for Anonymous users can access. It is that simple!

The question is there’re lots of pages in _layouts, and we can’t find a document to describe all these pages.

Friday, January 8, 2010

A bug in SharePoint User Profiles and Search

The users complain that the persons left our company are still searchable in SharePoint. I configured Source as Custom source in Configure Profile Import in User Profile and Properties. In this custom source, I configured it not load Disabled account from AD. Here is the link to another post about this: http://davidnotions.blogspot.com/2009/06/using-user-filter-to-limit-user-profile.html.

So I did a full import and View user profiles and see there’re lots of profiles (they are disabled accounts) in View Profiles Missing from Import. As per Microsoft (http://office.microsoft.com/en-us/sharepointserver/ha011604221033.aspx ), it seems these accounts should be removed after three-times full import. Unfortunately I did three-times full import and they were not removed. I have to say this is a bug.

So I have one more administration job: monitor Profiles Missing from Import and manually delete profiles in this list.

Monday, November 23, 2009

SharePoint List Filter web part

In SharePoint 2007 Enterprise version, Microsoft provides lots of Filter web part. One of them is SharePoint List Filter web part. It uses a SharePoint list as data source. The problem of this filter is that it doesn’t display the items in the list in the page, user has to click the filter icon to launch another window and then select an item in the popup window. My users complain that there’re too many clicks and they can’t see the items on the page.

Well, users are always right. So my job is to create a similar web part.

As this web part will connect to other web parts to provide filter function, first of all, the web part should inherit from ITransformableFilterValues.
public class SharePointListFilterWebPart : Microsoft.SharePoint.WebPartPages.WebPart, ITransformableFilterValues

Then override CreateChildControls.
try
{
base.CreateChildControls();

_values = new System.Web.UI.WebControls.RadioButtonList();

//Get all items from the list and add to the radio button control;
//Listname is a property so when configure the webpart, user can assign the list.
SPWeb web = Microsoft.SharePoint.SPContext.Current.Web;
SPList list = web.Lists[ListName];
SPListItemCollection listItems = list.Items;

if(listItems.Count > 0)
{
foreach (SPListItem listItem in listItems)
{
_values.Items.Add(new ListItem(listItem[ColumnName].ToString()));
}

//Default select the first item
if (!Page.IsPostBack)
_values.Items[0].Selected = true;

//auto postback when the user select different item.
_values.AutoPostBack = true;
this.Controls.Add(_values);
}
else
{
this.Controls.Add(new LiteralControl("There are no items in the list"));
}
}
catch (Exception ex)
{
//Exception handle
}

Then implement members in ITransformableFilterValues
public bool AllowEmptyValue { get { return false; } }
public bool AllowAllValue { get { return true; } }
public bool AllowMultipleValues { get { return true; } }
public string ParameterName { get { return ColumnName; } }

Add the following code to define the connection and the values to transfor.
public System.Collections.ObjectModel.ReadOnlyCollection ParameterValues
{
get
{
bool selected = false;

System.Collections.Generic.List values = new System.Collections.Generic.List();
for (int i = 0; i < _values.Items.Count; i++)
{
if (_values.Items[i].Selected)
{
values.Add(_values.Items[i].Value);

//for radion button
selected = true;
break;
}
}

if (!selected)
values.Add(_values.Items[0].Value);

System.Collections.ObjectModel.ReadOnlyCollection result = new System.Collections.ObjectModel.ReadOnlyCollection(values);
return result;
}
}

[ConnectionProvider(
"List",
"UniqueIDForListConnection",
AllowsMultipleConnections = true)]
public Microsoft.SharePoint.WebPartPages.ITransformableFilterValues SetConnection()
{
return this;
}


This is just a piece of my code. It’s better to install WSP Builder for Visual Studio which can create web part template and build SharePoint solution (*.wsp) easily.

Tuesday, September 8, 2009

Event 7076, 6398, 6482 regularly displayed in the Event Log on a SharePoint Server

I got these three errors in 2007 when I first built my SharePoint 2007 servers. Last month I built another MOSS 2007 dev environment and I got these errors again. Apart from the Event Log messages the symptoms that the customer may see are:

• In SharePoint Server 2007, tasks that are scheduled do not run.
• When you try to manage IIS 6.0 by using Server Manager, you receive a blank page, or you receive the following error message: the path specified cannot be used at this time

I think it’s better to write down the solution. A Windows Server 2003 hot fix 946517 is used for this issue.


Event Log details:

Event Id: 7076
Event Source: Office SharePoint Server
The Message text will contain:
- "Microsoft.Office.Server.Search.Administration.SearchAdminSharedWebServiceInstance"
- "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
- A reference to the Metabase in the call stack.

Event Id: 6398
Event Source: Windows SharePoint Services 3
The Message text will contain:
- "Microsoft.Office.Server.Administration.ApplicationServerAdministrationServiceJob"
- "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

Event Id: 6482
Event Source: Office SharePoint Server
The Message text will contain:
- "Microsoft.Office.Server.Search.Administration.SearchAdminSharedWebServiceInstance"
- "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
- A reference to the Metabase in the call stack.

Monday, July 27, 2009

Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown

I have some development experience in SharePoint OM. I programmed on web parts, features, events etc. Now it’s time to do SharePoint program by using SharePoint web services.

In my last post, I made a solution to display positions and other information of vessels in SharePoint. In this solution, BizTalk gets GPS text data from the vendor through FTP, converts to xml and then updates Vessel lists in several Vessel Pool sites. Finally the Google Map web part displays the vessels’ information.

I got this error when I worked on BizTalk side to call the SharePoint web service: “Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown”. This happened when I tried to get the list items in vessel list. This is because the URL I used to call the web service is TopSite + "/_vti_bin/Lists.asmx". The web service in SharePoint is scope based, which means I can only call the web services which are in the same site I’m operating. So I change the URL to SubSite + "/_vti_bin/Lists.asmx", and it works!

Tuesday, July 7, 2009

A Solution to Display Vessels’ Information on the Google Map

Currently I’m working for a shipping company which operates about 180 vessels. These vessels belong to different vessel pools, and each pool has a SharePoint site which contains shared documents, lists, and minutes and so on. What the users want is to display the vessels’ information, especially the position information on a map in their site. A vendor is providing geographic information now. It uploads a text file through FTP twice per day. The text file contains the following information: Call sign, IMO (International Marine Organization) No., Vessel name, Polling time, Latitude, Longitude, Ship speed, Ship direction. So the question is how to update vessels’ information automatically in a map in SharePoint site.

My solution is to use BizTalk to update data and create a Google Map web part to display the vessels’ information.

First I created a list called Vessels in each pool site. The list has all the columns in the text file plus some additional columns. A BizTalk application was created to monitor the FTP folder, pick up the text file and parse it to xml. A map, an orchestration and a SharePoint adapter send port were created to update list Vessels in each pool site. So the lists keep updated.

Then I created a Google Map web part which gets positions’ information from list Vessels. I customized the Icon and the InforWindow so they can contain more information about vessels. It looks perfect.

So far so good except for one issue. The pool sites are shared between our employees and customers. The customers access the pool sites through VPN and the URLs are different from the ones our employees use. The Google Map API key I generated from Google is based on one URL, and it doesn’t work in another URL!

Tuesday, June 30, 2009

Error when you try to edit the content source schedule in Microsoft Office SharePoint Server 2007: "Access is denied"

I had this problem long time ago. I post here just in case someone has the same issue.

When you try to create a new schedule or change an existing schedule, you receive the error message "access is denied". Or in the environment with a dedicated search index server, open Centre Admin in the server which is not the search index server, clicking Search Settings in SSP, got IIS error HTTP 403.

To resolve this issue, please look at Microsoft knowledge base http://support.microsoft.com/kb/926959

Monday, June 29, 2009

Using User Filter to Limit User Profile Import in SharePoint

If you’ve ever tried to setup SharePoint 2007 to import user profiles via LDAP you’ll like this post. The setup of the SSP to import profiles is a fairly simple task, but what is not that easy is applying the right LDAP user filter to import only the accounts that you desire from Active Directory. I’d like to share with you my experience with applying user filters and some of the excellent user filter examples I have found. The user filter is a string in User filter in the page “Create New Connection” which is in User Profile and Properties section in SSP.

Below are some samples of LDAP User Filters:

Default user filter:
(&(objectCategory=Person)(objectClass=User))

Exclude disabled accounts:
(&(objectCategory=person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2))

Exclude accounts with no email address and disabled accounts:
(&(objectCategory=Person)(objectClass=User)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(mail=*))

Exclude accounts with passwords set to expire:
(&(objectCategory=person)(objectClass=user)(!userAccountControl=65536))

Include only the accounts with valid email addresses
(&(objectCategory=Person)(objectClass=User)(mail=*com)

Include only the accounts that are part of the Branch1 organizational unit
(&(objectCategory=Person)(objectClass=User)(memberof:1.2.840.113556.1.4.1941:=(CN=Authenticated Users,OU=Branch1,DC=domain,DC=local)))

Exclude accounts that don’t have a first name
(&(objectCategory=Person)(objectClass=User)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(!(!givenName=*)))

Wednesday, June 24, 2009

Display Left Navigation on Web Part Page Stored in a Document Library

The users in one group in my company decided to use web part pages to host multiple document libraries and lists in one page. To be honest, I don’t like this as once the users know how to create pages, they will create more and more pages, and in each pages they will create more and more libraries and lists, finally both the users and I will be crazy to manage the huge number of libraries and lists. (Unfortunately this has happened. When I clicked View All Contents, I got a huge list of libraries and lists). Anyway, user is GOD, so I did for them.

Now it comes a problem. When a user click the page, the left navigation gone! Users need it back.

After some investigations, I noticed that these pages have an empty placeholder that actually overrides what is there in the master page.

<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderNavSpacer" runat="server"></asp:Content>

Open these pages in the SharePoint Designer. If you remove above lines, you'll have the left navigation again visible on the page.

If you don’t want to modify page by page, there’re two ways to achieve the goal: first one, modify the master page. Second one, remove the above three lines from the template files (8 templates) which locate in \12\TEMPLATE\1036\STS\DOCTEMP\SMARTPGS\spstdX.aspx (X is from 1 to 8)

But I don't recommand you to use these two ways as the first one affects all pages in the site collections, and the second affects all pages created after the changing in the FARM.

Monday, June 15, 2009

An Issue in Updating SharePoint Form Library Column from K2

This is the same K2 InfoPath Integrated workflow which mentioned in my last post. After the form is uploaded to the SharePoint form library, I’m trying to use K2 SharePoint Document Events to update SharePoint library columns(the values are from some fields in the form). For most test cases, it works fine. But I get the following error if there’re special character such as ‘&’, ‘<’ and ‘>’ in the field which is used to update the column.

An error occurred while parsing EntityName. Line 1, position 1945.

It seems this is a known issue and K2 support told me they will fix this issue in the next SP. Well, I can’t wait for them as this workflow is running in my production. Luckily I figured out a simple solution. When publishing the form to SharePoint form library, in the publish wizard at “You can make forma data listed below available as column names on a SharePoint site” step, I chose the fields which were used as columns. And then in K2, I removed K2 SharePoint Document Events which I used to update the library columns. In another words, I used SharePoint to update the columns from the form fields instead of using K2 to update SharePoint columns. It works perfectly.

Wednesday, June 10, 2009

A Sample of ADF Connecting to Oracle Database

Currently I’m working on BDC in SharePoint 2007. I’m trying to create a BDC Application Definition File (ADF) which connects to an Oracle database, and I didn’t know how to fill the connection properties. I did a search from Google and couldn’t find a sample. So I post the piece of xml which contains connection part here.

<Properties>
<Property Name="DatabaseAccessProvider" Type="Microsoft.Office.Server.ApplicationRegistry.SystemSpecific.Db.DbAccessProvider">Oracle</Property>
<Property Name="AuthenticationMode" Type="Microsoft.Office.Server.ApplicationRegistry.SystemSpecific.Db.DbAuthenticationMode">RevertToSelf</Property>
<Property Name="RdbConnection Data Source" Type="System.String">tnsDBname</Property>
<Property Name="RdbConnection Pooling" Type="System.String">false</Property>
<Property Name="RdbConnection User ID" Type="System.String">rouser</Property>
<Property Name="RdbConnection Password" Type="System.String">rouser</Property>
<Property Name="RdbConnection Integrated Security" Type="System.String"></Property>
<Property Name="WildcardCharacter" Type="System.String">%</Property>
</Properties>

The tnsDBname is the data source name I defined in tnsname.ora (Of course you should have Oracle client installed in your SharePoint server). “rouser” is my read-only account to that database.

A good choice is to use Microsoft BDC Generator, but it asks you to enter the connection string. A better choice is to use BDCMetaMan. When connecting to Oracle database, in Server Name in the popup window, remember to input the tnsname, not the physical server name.

Thursday, June 4, 2009

Error "The tracking (workstation) service is not running" in IIS

Office Server Web Services web application in my SharePoint Server stopped! I tried to start it and got this error:

The tracking (workstation) service is not running

Simple fix is starting up the SSL service by running the following command and then start that web application.

net start httpfilter

Got error "Could not Connect to the server. Please make sure the site is accessible." in SharePoint Search

Well, probably only I had this issue. Here is my scenario.


I have a SharePoint farm which is composed of two web servers and one database server. There is a SharePoint web application running on port 31000. For some reason, I extended the web application to another one with port number 80 and host head value MyFQDN. Months later, I decided to stop using the extended application, so I configured the host head value of the original application with port number 31000, and stopped the extended one (but not delete it).

Everything was running well until yesterday the search engine failed to crawl. I got this error:

Could not Connect to the server. Please make sure the site is accessible.

Well, you could find this is a common error in the search if you do some investigation from Google. But this time no solution worked for me. As this is my production environment, I have to make it work as soon as possible. So I changed the Content sources from http://machinename:31000/ to http://myfqdn/ and do a full crawl. It worked!

Now I have time to do more investigations. Usually I only work on the first web server to run Central Admin and to check IIS. As usual I opened IIS Manager in the first server and nothing was different. I didn’t know why I connected to the IIS services in the second web server but I did connect. What?! The original web application stopped and the extended one was running! Who did that?

So I stopped the extended application and started the original one in the second web server, then back to the Central Admin, changed the Content sources back to http://machinename:31000/ and did a full crawl. It worked!

This time I deleted the extended web application from the two web server!

Monday, June 1, 2009

Access denied when crawling MOSS Content

The SharePoint search is configured properly and everything is running perfectly. My SharePoint web applications use Kerberos authentication. I applied .NET 3.5 SP1 and the search didn’t work. I got the following error:


Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled. (The item was deleted because it was either not found or the crawler was denied access to it.)

Lots of blogs talked about this issue. The suggested solution is below:

Disable the loopback check

Follow these steps:
1. Click Start, click Run, type regedit, and then click OK.
2. In Registry Editor, locate and then click the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
3. Right-click Lsa, point to New, and then click DWORD Value.
4. Type DisableLoopbackCheck, and then press ENTER.
5. Right-click DisableLoopbackCheck, and then click Modify.
6. In the Value data box, type 1, and then click OK.
7. Quit Registry Editor, and then restart your computer.

Source: http://support.microsoft.com/kb/896861

This resolved the issue in my production but not QA!

So what’s the difference between my production and QA?

After one day investigation, I found there was a wrong Kerberos setting in QA. Run the following:


Setspn –l severname


I found there was a line like this: HTTP/servername:portnumber other than HTTP/servername. So I run setspn –d HTTP/servername:portnumber SharePointServiceAccount to remove it, did a search again and it worked!