Showing posts with label MOSS. Show all posts
Showing posts with label MOSS. Show all posts
Thursday, January 14, 2010
Error when deploying a solution
Today I was trying to install one of the "fantastic 40" templates and when I tried deploying the wsp file, the job started running and resulted in an "error" state. There was nothing in the Event Logs and nothing in the ULS logs either. After some reading on the MS forum, I saw a post where someone suggested (for a similar problem) that the Windows SharePoint Services Administration service had to be running. So I restarted this service on all servers and tried to deploy again... and it worked! I don't know if this will apply in all situations where you just get an error when deploying a solution (most likely not), but it's something you can give a try...
Thursday, April 3, 2008
The file manifest.xml does not exist in the solution package
It's been a while since my last post (I'd really need to write that post on how to integrate Dynamics AX into MOSS ) and this one will also just be a quickie...
When trying to add my solution to the solution store, I got the error The file manifest.xml does not exist in the solution package. This was weird, because I didn't change anything to the deployment parts of my solution and it had always worked before... Also, the manifest.xml file seemed to be inside the wsp file just fine. Thanks to this blog, I was able to solve it!
Apparently, you get this error the moment your package gets too big. Mark Beij mentions 1440kb, but with me it already occured when my package got over 1400kb. The solution is to add the following lines to the top of your cab.ddf file:
.Set CabinetFileCountThreshold=0
.Set FolderFileCountThreshold=0
.Set FolderSizeThreshold=0
.Set MaxCabinetSize=0
.Set MaxDiskFileCount=0
.Set MaxDiskSize=0
Now that all the size limitations are off, just make your wsp file again and you should be able to add your solution again.
When trying to add my solution to the solution store, I got the error The file manifest.xml does not exist in the solution package. This was weird, because I didn't change anything to the deployment parts of my solution and it had always worked before... Also, the manifest.xml file seemed to be inside the wsp file just fine. Thanks to this blog, I was able to solve it!
Apparently, you get this error the moment your package gets too big. Mark Beij mentions 1440kb, but with me it already occured when my package got over 1400kb. The solution is to add the following lines to the top of your cab.ddf file:
.Set CabinetFileCountThreshold=0
.Set FolderFileCountThreshold=0
.Set FolderSizeThreshold=0
.Set MaxCabinetSize=0
.Set MaxDiskFileCount=0
.Set MaxDiskSize=0
Now that all the size limitations are off, just make your wsp file again and you should be able to add your solution again.
Thursday, February 21, 2008
Rendering a list programmatically
Today, I was trying to display list data in a Web Part programmatically and have it behave the same way as the default SharePoint lists do. I was given a Web Part that was using an SPGridView to do this, but the filtering in it didn't work the way it was supposed to and it also didn't show which column it was filtered on (as default SharePoint lists do).
Thanks to this post, I was able to render the list the same way default lists get rendered. Here's an example on how to do it for the tasks list, including an example Caml query that sorts the view by title and filters it so that it shows only the incomplete tasks assigned to the current user. Beware though: when using this Caml query, sorting and filtering won't work since it will always render the view by the conditions you have provided in your query. Still working on solving this...
private string html;
protected override void OnPreRender(EventArgs e)
{
using (SPSite mySite = SPContext.Current.Site)
{
using (SPWeb myWeb = mySite.OpenWeb())
{
SPList myList = myWeb.Lists["Tasks"];
SPView myView = myList.Views["All Tasks"];
SPQuery myQuery = new SPQuery(myView);
myQuery.Query = "<OrderBy><FieldRef Name=\"Title\" /></OrderBy><Where><And><Eq><FieldRef Name=\"AssignedTo\" /><Value Type=\"User\"><UserID/></Value></Eq><Neq><FieldRef Name=\"Status\" /><Value Type=\"Choice\">Completed</Value></Neq></And></Where>";
html = myList.RenderAsHtml(myQuery);
this.Title = "Tasks";
}
}
}
protected override void Render(HtmlTextWriter writer)
{
writer.Write(html);
}
Thanks to this post, I was able to render the list the same way default lists get rendered. Here's an example on how to do it for the tasks list, including an example Caml query that sorts the view by title and filters it so that it shows only the incomplete tasks assigned to the current user. Beware though: when using this Caml query, sorting and filtering won't work since it will always render the view by the conditions you have provided in your query. Still working on solving this...
private string html;
protected override void OnPreRender(EventArgs e)
{
using (SPSite mySite = SPContext.Current.Site)
{
using (SPWeb myWeb = mySite.OpenWeb())
{
SPList myList = myWeb.Lists["Tasks"];
SPView myView = myList.Views["All Tasks"];
SPQuery myQuery = new SPQuery(myView);
myQuery.Query = "<OrderBy><FieldRef Name=\"Title\" /></OrderBy><Where><And><Eq><FieldRef Name=\"AssignedTo\" /><Value Type=\"User\"><UserID/></Value></Eq><Neq><FieldRef Name=\"Status\" /><Value Type=\"Choice\">Completed</Value></Neq></And></Where>";
html = myList.RenderAsHtml(myQuery);
this.Title = "Tasks";
}
}
}
protected override void Render(HtmlTextWriter writer)
{
writer.Write(html);
}
Tuesday, January 22, 2008
“This site is not found in the SharePoint configuration database.” when registering a site in Dynamics Ax
At the moment, I am working on integrating MOSS and Dynamics Ax, so you can expect some updates on this topic the next few weeks.
If you want to use the out-of-the-box integration, you can either create SharePoint sites using the Dynamics Enterprise Portal site template, or you can register the site in Ax to be able to use the Dynamics Web Parts in your existing SharePoint site. For my situation, I needed this last option, but when testing this, I regularly got the next error:
Error:
This site is not found in the SharePoint configuration database.
The solution for this problem may or may not be very simple... If you're lucky, just remove the slash at the end of the url and you shouldn't get the error anymore. With other sites, this won't work though and I haven't found the solution to this either, so if you were able to solve it, feel free to let me know how you did it!
Update: Also check your casing. This seemed to work in my situation…
If you want to use the out-of-the-box integration, you can either create SharePoint sites using the Dynamics Enterprise Portal site template, or you can register the site in Ax to be able to use the Dynamics Web Parts in your existing SharePoint site. For my situation, I needed this last option, but when testing this, I regularly got the next error:
Error:
This site is not found in the SharePoint configuration database.
The solution for this problem may or may not be very simple... If you're lucky, just remove the slash at the end of the url and you shouldn't get the error anymore. With other sites, this won't work though and I haven't found the solution to this either, so if you were able to solve it, feel free to let me know how you did it!
Update: Also check your casing. This seemed to work in my situation…
Labels:
Axapta,
Dynamics Ax,
MOSS,
register SharePoint site in Ax
Wednesday, April 18, 2007
Creating a document library with a view with grouping in MOSS programmatically
For this project I'm on at the moment, a document library needed to be created programmatically. It needed a view and inside the view, a grouping had to be made.
To do this, I found some info on the various steps on some blogs, msdn, ... but I hardly found anything about grouping. This is why I thought it would be useful to post a code example of the whole thing: creating a document library, creating a view on it and creating a grouping.
The code is fairly simple once you know it, so I won't go any deeper into it. If you've got any questions though, feel free to ask!
WebToAddLibraryTo.AllowUnsafeUpdates = true;
SPListTemplate listTemplate = WebToAddLibraryTo.ListTemplates["Document Library"];
System.Guid guidLib = WebToAddLibraryTo.Lists.Add("Title", "Description", listTemplate);
WebToAddLibraryTo.Update();
SPList docLib = WebToAddLibraryTo.Lists[guidLib];
docLib.EnableVersioning = true;
docLib.EnableMinorVersions = true;
docLib.OnQuickLaunch = true;
docLib.Fields.Add("Field name", SPFieldType.Text, true);
docLib.Fields.Add("Another field name", SPFieldType.Text, false);
docLib.Fields.Add("Date field", SPFieldType.DateTime, false);
StringCollection resultStrings = new StringCollection();
resultStrings.Add("Positive");
resultStrings.Add("Negative");
docLib.Fields.Add("Result", SPFieldType.Choice, false, false, resultStrings);
StringCollection viewFieldCollection = new StringCollection();
viewFieldCollection.Add("DocIcon");
viewFieldCollection.Add("LinkFilename");
viewFieldCollection.Add("Another field name");
viewFieldCollection.Add("Date field");
viewFieldCollection.Add("Result");
string defaultQuery ="<GroupBy Collapse=\"TRUE\" GroupLimit=\"100\">" +
"<FieldRef Name=\"Field name\">" +
"<FieldRef Name=\"ContentType\">" +
"</GroupBy>" +
"<OrderBy>" +
"<FieldRef Name=\"LinkFileName\">" +
"</OrderBy>";
Guid oldViewId = docLib.DefaultView.ID;
docLib.Views.Delete(oldViewId);
SPView newView = docLib.Views.Add("New view", viewFieldCollection, defaultQuery, 100, true, true, SPViewCollection.SPViewType.Html, false);
docLib.DefaultView.Update();
docLib.Update();
To do this, I found some info on the various steps on some blogs, msdn, ... but I hardly found anything about grouping. This is why I thought it would be useful to post a code example of the whole thing: creating a document library, creating a view on it and creating a grouping.
The code is fairly simple once you know it, so I won't go any deeper into it. If you've got any questions though, feel free to ask!
WebToAddLibraryTo.AllowUnsafeUpdates = true;
SPListTemplate listTemplate = WebToAddLibraryTo.ListTemplates["Document Library"];
System.Guid guidLib = WebToAddLibraryTo.Lists.Add("Title", "Description", listTemplate);
WebToAddLibraryTo.Update();
SPList docLib = WebToAddLibraryTo.Lists[guidLib];
docLib.EnableVersioning = true;
docLib.EnableMinorVersions = true;
docLib.OnQuickLaunch = true;
docLib.Fields.Add("Field name", SPFieldType.Text, true);
docLib.Fields.Add("Another field name", SPFieldType.Text, false);
docLib.Fields.Add("Date field", SPFieldType.DateTime, false);
StringCollection resultStrings = new StringCollection();
resultStrings.Add("Positive");
resultStrings.Add("Negative");
docLib.Fields.Add("Result", SPFieldType.Choice, false, false, resultStrings);
StringCollection viewFieldCollection = new StringCollection();
viewFieldCollection.Add("DocIcon");
viewFieldCollection.Add("LinkFilename");
viewFieldCollection.Add("Another field name");
viewFieldCollection.Add("Date field");
viewFieldCollection.Add("Result");
string defaultQuery ="<GroupBy Collapse=\"TRUE\" GroupLimit=\"100\">" +
"<FieldRef Name=\"Field name\">" +
"<FieldRef Name=\"ContentType\">" +
"</GroupBy>" +
"<OrderBy>" +
"<FieldRef Name=\"LinkFileName\">" +
"</OrderBy>";
Guid oldViewId = docLib.DefaultView.ID;
docLib.Views.Delete(oldViewId);
SPView newView = docLib.Views.Add("New view", viewFieldCollection, defaultQuery, 100, true, true, SPViewCollection.SPViewType.Html, false);
docLib.DefaultView.Update();
docLib.Update();
Monday, February 5, 2007
How to add a BestBet in SharePoint 2007 programmatically
First of all: hi! I'm Tom, software engineer at Dolmen (you know, the company where the infamous jopx works, not by coïncidence the person who I report to...). It took me a while to start blogging, but when I was looking for information on adding BestBets and Keywords programmatically and I couldn't find a thing, it just felt like the right moment to start a blog and "share the wisdom" as they say. Adding Keywords and BestBets is actually not that difficult, you just have to know the right syntax to do so. That's where I come in: here's what I did to make it work:
Now let's explain what this code does...
To start off, we create a boolean that tells us whether the Keyword we want to add a BestBet for is already in the Keywordcollection or not. If it isn't, we'll add it at the end of our code.
The next step is to get all the Keywords of the current Sitecollection you are working on. To do so, we need to create a new Keywordcollection with the context of the current Sitecollection and the url of this Sitecollection.
Once we've found the Keywords, we're going to browse through all the Keywords of the current Sitecollection to check for a match with the Keyword you want to add a BestBet for (in the example I've just used "textToCompareTo" as the string we're looking for). If we find this Keyword in the Keywordcollection, we're going to browse through all the BestBets that have been assigned to this Keyword, to check whether the BestBet we want to add is already part of the BestBetcollection or not. If it is, then our job is done and we don't have to do a thing anymore. If it isn't, we'll add it by creating a new BestBet with a certain title, description and an url we want the BestBet to refer to.
So there you go, not that hard as I first thought it was going to be. If there's any questions or remarks, feel free to leave a comment.
bool found = false;
Keywords keys = new Keywords(SearchContext.GetContext(SPContext.Current.Site), new Uri(SPContext.Current.Site.Url));
foreach (Keyword key in keys.AllKeywords)
{
if (key.Term.ToLower() == textToCompareTo.ToLower())
{
found = true;
bool foundBet = false;
foreach (BestBet bet in key.BestBets)
{
if (bet.Url == urlToReferTo)
{
foundBet = true;
}
}
if (!foundBet)
{
key.BestBets.Create("Title", "BestBet description", urlToReferTo);
}
break;
}
}
if (!found)
{
keys.AllKeywords.Create(textToCompareTo.ToLower(), DateTime.Now);
}Now let's explain what this code does...
To start off, we create a boolean that tells us whether the Keyword we want to add a BestBet for is already in the Keywordcollection or not. If it isn't, we'll add it at the end of our code.
The next step is to get all the Keywords of the current Sitecollection you are working on. To do so, we need to create a new Keywordcollection with the context of the current Sitecollection and the url of this Sitecollection.
Once we've found the Keywords, we're going to browse through all the Keywords of the current Sitecollection to check for a match with the Keyword you want to add a BestBet for (in the example I've just used "textToCompareTo" as the string we're looking for). If we find this Keyword in the Keywordcollection, we're going to browse through all the BestBets that have been assigned to this Keyword, to check whether the BestBet we want to add is already part of the BestBetcollection or not. If it is, then our job is done and we don't have to do a thing anymore. If it isn't, we'll add it by creating a new BestBet with a certain title, description and an url we want the BestBet to refer to.
So there you go, not that hard as I first thought it was going to be. If there's any questions or remarks, feel free to leave a comment.
Subscribe to:
Posts (Atom)
