January 15th, 2008 by chadclarke
The description for Event ID ( 27745 ) in Source ( Windows SharePoint Services 3 ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: #50071: Unable to connect to the database SharePoint_Config on pfc-penndb-tst. Check the database connection information and make sure that the database server is running..
I keep getting this error in my error logs for our Test/Staging Portal. I'm unsure where its coming from. Any ideas?
————————————————————–
This issue was a component service. So go into Component Services and drill down to DCOM, then there was a OSearch service there that needed our service account SPSWorker added with launch and activate priviledges.
Another fun Debug!
Someone else's fix for this issue:
" I don't know exactly what fixed it, but somewhere along the way:
* reset farm credentials (just the stsadm -o updatefarmcredentials; not the rest) as described in http://support.microsoft.com/kb/934838 - this involved IISReset's on every server in the farm
* bumped timer job
* bumped administrative service job on the index server (probably should bump those jobs on the other servers as well)"
Posted in Uncategorized | No Comments »
December 6th, 2007 by chadclarke
I thought I would get a dialogue going about Microsoft Trial SharePoint VPC. My new consulting company has me looking into it as a viable tools for proof of concepts and demoing purposes. Well, I have a few concerns. One, the VPC has a trial version of Visual Studio 2005, which the trial version does not install the templates for VS 2005 and does not have a command prompt for your use. Therefore, I try to install the templates for wss 3.0 but no templates are installed into VS 2005. So I can't build a web part(save for from scratch). I can't build a site definition or any of the like. I'm very discouraged by this discovery. I am currently attempting to get VSTA on the trial version to program with InfoPath 2007, but I am doubtful it will work… Please if anyone has attempted to use the trial vpc for such tasks and been successful or had the same luck as I have. Please post your comments here!
Posted in Uncategorized | No Comments »
December 4th, 2007 by chadclarke
Hi there everyone. I am looking to get my MCTS in Sharepoint Developing. I need to pass the 70-542 Exam. I've found an microsoft e-learning course which seems to be very helpful, but I'm looking for any resources that anyone has come across out there. Please post comments with resources. Also please let me know if you have taken the exam and your impressions on it?
Posted in Uncategorized | 2 Comments »
November 13th, 2007 by chadclarke
So this is an interesting issue. The problem that I was having to cause this error to come up was using the SPSite.AllWebs[Guid] collection to get the web that I wanted. Well, when the code is run under the impersonation of a user that doesn't have access to all of the webs, they run into the AccessDenied.aspx, List does not exist error. They aren't able to access the allwebs collection that the administrator can. So remember this, use the SPSite.OpenWeb(Guid) function instead!
It will save you all kinds of trouble. Safe journeys in the world of SharePoint!
Posted in Uncategorized | No Comments »
November 6th, 2007 by chadclarke
Translations/Definitions:
SPPrincipal = Base class of all group/user classes in MOSS 2007, when a method asks to be passed an SPPrincipal object, you can pass it an SPGroup or SPUser object.
SPGroup = Cross Site Group
SPUser = AD Accounts(group/user) Note: This is if you are using AD for authentication…
SPRoleDefinition = Permission Level
SPRoleAssignment = Instance of Authorization for a SPGroup/SPUser utilizing and SPRoleDefinition(permission level) to grant access
Relationships:
SPRoleDefinition + SPUser/SPGroup = SPRoleAssignment
Typical Security Add:
First you need a SPRoleDefinition that states what authorization the SPRoleAssignment will have. Then instantiate a SPRoleAssignment with either a login or instance of the SPPrincipal class. Bind the instance of SPRoleDefinition to the instance of SPRoleAssignment and then add the instance of SPRoleAssignment to the Site.
For Example:
SPRoleDefinition roleDefViewOnly = newSite.RoleDefinitions["View Only"];
SPRoleAssignment roleAssignNAMs = new SPRoleAssignment(newSite.SiteGroups["NAMS"]);
roleAssignDomainUsers.RoleDefinitionBindings.Add(roleDefViewOnly);
newSite.RoleAssignments.Add(roleAssignNAMs);
SPUser pool = newSite.SiteUsers(loginName);
SPGroup pool = newSite.SiteGroups(groupName);
Note: If you attempt to user the BreakUserRoleInteritance Method… This is an all inclusive method and in which case it performs an allowunsafeupdates = true and an allowunsafeupdates = false. This will cause you frustration, because you'll set allunsafeupdates = true before you start playing with security and then after the BreakUserRoleInheritance method you do a .Update, and low and behold you'll get an exception that GET request are not allowed… And you'll wonder why…
This really is a cohesive object model for SPSecurity, although its not neccessarily apparent when you begin to work with it.Safe Journey's in the world of sharepoint!
Posted in Uncategorized | No Comments »
October 26th, 2007 by chadclarke
So if you create a list on a typical site in Sharepoint, you'll notice that the web part contained within does not have a title. Fair enough, wouldn't look great with one, but if you want to add a web part below that one, and keep this web parts title on the screen, you can't! I keep setting its web part properties to "Title only" and it keep switching back to "None" everytime in hit ok. I even tried to trick sharepoint by select apply and then cancel, but that didn't work either! I'm ready to cry, cause I promised my client a scripting solution that utilized the title of the web part as its identifier. If anyone has had any similar solution or found a work around, please let me know!
Posted in Uncategorized | No Comments »
October 19th, 2007 by chadclarke
Ok, so I can use this web part and it adds to the list just fine, but when my colleague with the same permissions to the list uses it, she can't get it to add to the list…. I implemented the run with elevated priviledges and used guids instead of using the spcontext.current(heard that negates the elevated priviledges) Any thoughts?
private void PopulateDataset()
{
try
{
mySite = new SPSite(siteURL);
try
{
myWeb = mySite.OpenWeb(parentURL);
}
catch
{
myWeb = mySite.RootWeb;
}
favList = myWeb.Lists[listName];
NAPWS.Service napService = new global::WPRecordSiteVisits.NAPWS.Service();
oDataSet = napService.SearchClients();
oView.Table = oDataSet.Tables[0];
}
catch(Exception e){
lblError.Text += "| PopulateDataSet: " + e.Message;
}
}
private void RecordSiteVisits()
{
try{
if ((HttpContext.Current.Request.UrlReferrer == null || HttpContext.Current.Request.UrlReferrer.AbsoluteUri.IndexOf(SPContext.Current.Web.Url) == -1) && (HttpContext.Current.Session["Referrer"] == null || HttpContext.Current.Session["Referrer"].ToString().IndexOf(SPContext.Current.Web.Url) == -1))
{
if (HttpContext.Current.Session["Referrer"] != null)
HttpContext.Current.Session["Referrer"] = SPContext.Current.Web.Url;
string pathString = HttpContext.Current.Request.Url.AbsolutePath.ToString();
string strNC_Number = "";
if (pathString.IndexOf("NAP/") != -1)
{
pathString = pathString.Substring((pathString.IndexOf("NAP/") + 4));
strNC_Number = pathString.Split(new String[] { "/" }, StringSplitOptions.None)[0];
}
SPQuery newQuery = new SPQuery();
strNC_Number = "346";
int nc_Number = Convert.ToInt32(strNC_Number);
newQuery.Query = "<Where><Eq><FieldRef Name="NC_NUMBER"/><Value Type="Text">" + nc_Number + "</Value></Eq></Where>";
SPListItemCollection thisCollection = favList.GetItems(newQuery);
try
{
if (thisCollection.Count == 0)
{
SPListItem newItem = myWeb.Lists[listName].Items.Add();
oView.RowFilter = "NC_NUMBER = '" + nc_Number + "'";
newItem["NC_NAME"] = oView.ToTable().Rows[0]["NC_NAME"];
newItem["NC_NUMBER"] = nc_Number;
SPSite mySite = new SPSite(SPSiteGuid);
SPWeb myRootSite = mySite.OpenWeb(SPWebGuid);
//SPWeb myRootSite = SPContext.Current.Web;
String login = myRootSite.CurrentUser.LoginName;
newItem["UserLoginWithDomain"] = login;
newItem["Category"] = "Automatic";
newItem["Site Visits"] = 1;
myWeb.AllowUnsafeUpdates = true;
newItem.Update();
myWeb.AllowUnsafeUpdates = false;
}
else if (thisCollection.Count == 1)
{
SPListItem tmpItem = thisCollection[0];
tmpItem["Site Visits"] = Convert.ToInt32(tmpItem["Site Visits"]) + 1;
myWeb.AllowUnsafeUpdates = true;
tmpItem.Update();
myWeb.AllowUnsafeUpdates = false;
}
else
{
lblError.Text += "Duplicate Records exist in your my favorites list for the national client";
}
}
catch (Exception error)
{
lblError.Text += " |RecordSiteVisits: "+error.Message;
}
}
}
catch (Exception error2)
{
lblError.Text += error2.Message;
}
}
private void RecordSiteVisits()
{
try{
if ((HttpContext.Current.Request.UrlReferrer == null || HttpContext.Current.Request.UrlReferrer.AbsoluteUri.IndexOf(SPContext.Current.Web.Url) == -1) && (HttpContext.Current.Session["Referrer"] == null || HttpContext.Current.Session["Referrer"].ToString().IndexOf(SPContext.Current.Web.Url) == -1))
{
if (HttpContext.Current.Session["Referrer"] != null)
HttpContext.Current.Session["Referrer"] = SPContext.Current.Web.Url;
string pathString = HttpContext.Current.Request.Url.AbsolutePath.ToString();
string strNC_Number = "";
if (pathString.IndexOf("NAP/") != -1)
{
pathString = pathString.Substring((pathString.IndexOf("NAP/") + 4));
strNC_Number = pathString.Split(new String[] { "/" }, StringSplitOptions.None)[0];
}
SPQuery newQuery = new SPQuery();
strNC_Number = "346";
int nc_Number = Convert.ToInt32(strNC_Number);
newQuery.Query = "<Where><Eq><FieldRef Name="NC_NUMBER"/><Value Type="Text">" + nc_Number + "</Value></Eq></Where>";
SPListItemCollection thisCollection = favList.GetItems(newQuery);
try
{
if (thisCollection.Count == 0)
{
SPListItem newItem = myWeb.Lists[listName].Items.Add();
oView.RowFilter = "NC_NUMBER = '" + nc_Number + "'";
newItem["NC_NAME"] = oView.ToTable().Rows[0]["NC_NAME"];
newItem["NC_NUMBER"] = nc_Number;
SPSite mySite = new SPSite(SPSiteGuid);
SPWeb myRootSite = mySite.OpenWeb(SPWebGuid);
//SPWeb myRootSite = SPContext.Current.Web;
String login = myRootSite.CurrentUser.LoginName;
newItem["UserLoginWithDomain"] = login;
newItem["Category"] = "Automatic";
newItem["Site Visits"] = 1;
myWeb.AllowUnsafeUpdates = true;
newItem.Update();
myWeb.AllowUnsafeUpdates = false;
}
else if (thisCollection.Count == 1)
{
SPListItem tmpItem = thisCollection[0];
tmpItem["Site Visits"] = Convert.ToInt32(tmpItem["Site Visits"]) + 1;
myWeb.AllowUnsafeUpdates = true;
tmpItem.Update();
myWeb.AllowUnsafeUpdates = false;
}
else
{
lblError.Text += "Duplicate Records exist in your my favorites list for the national client";
}
}
catch (Exception error)
{
lblError.Text += " |RecordSiteVisits: "+error.Message;
}
}
}
catch (Exception error2)
{
lblError.Text += error2.Message;
}
}
Posted in Uncategorized | No Comments »
October 17th, 2007 by chadclarke
Wow, this event was extraordinarily useful! From Document Management and Office integration to Features Building and AJAX Web Parts. They had it covered. Very impressive. If you are interested in MOSS 2007 at any level you should check out the recorded sessions at http://events.unisfair.com/rt/sharepoint~oct07.
Posted in Uncategorized | No Comments »
October 16th, 2007 by chadclarke
I watched a video with Andrew Connell, and it was brought to my attention that Custom Field Controls may be more appropriate than custom web parts in certain situations… One question that I have is whether the tool pane is accessible for the end user when dealing with a field control… Can the developer set configuration data for a custom field control from sharepoint designer? Please post any thoughts you may have.
Posted in Uncategorized | No Comments »
October 10th, 2007 by chadclarke
When building custom web parts its essential to understand when controls will contain thier values and when they don't and how to keep variables that will contain their values throughout the web part life cycle. Especially if you would like to dynamically load one control based on another controls input.
1. In CreateChildControls, No control will contain a value, not even hidden fields. This eliminates some uses of a common practice of utilizing hidden field to maintain viewstate.
2. ViewState Parameters are great for maintaining values throughout the web part lifecycle. Initialize them in the constructor of a web part to avoid null errors.
Initializing a view state parameter:
ViewState["parameter1"] = "";
Retrieving a value from view state:
string this = ViewState["parameter1"].toString();
3. If you would like to maintain a web parts state while navigation persists in your website, you can utilize session state variables with the following code:
Adding a variable to session state:
HttpContext.Current.Session.Add("variablename1", "value1");
Retrieving a variable from session state:
writer.Write("'" + HttpContext.Current.Session["variablename1"] + "'");
Posted in Uncategorized | No Comments »