MOSS - Large File LimitsPosted by Nilesh Mehta in
SharePoint Recently at one of our customer sites, we were running in to issues with downloading large files from MOSS Windows Explorer View. Users had been able to upload a large file to a SharePoint document library using the upload file features of a Document Library. However, when trying to download the same file using Windows Explorer view, they were getting errors. NOTE: They could still download the same file using right-click save-as option or the send to menu on a file in the document library. Upong opening a case with Microsoft, we found that it is because during download from a Windows Explorer view, the protocol that is being used required a "Contiguous" chunk of memory that is twice the size of the file that is being downloaded. On a 32-bit OS, there is a limit of 2GB per application pool. Our application pools were always running around 700MB or so and hence after that for some reason, it was not able to find a contiguous chunk of memory that might be about 500 MB or so (Large files 200MB or more). This would cause downloads to fail. Microsoft has mentioned this to be dependant on how the code was writtten and would possibly be fixed with the next version of SharePoint. Unfortunately, there is no immediate fix available. The only option that they have suggested at this point is to migrate to a 64-bit OS and maybe 64-bit MOSS. Not sure how it is going to work out, but hopefully this information helps someone. Cheers, Microsoft Gold Certified Partner!!!!Posted by Nilesh Mehta in
NGenious Solutions, Inc. is proud to announce that it has achieved the highest level of Microsoft Partnership in the Information Worker and ISV competencies. Gold Certified Partners represent the highest level of competence and expertise with Microsoft technologies, and have the closest working relationship with Microsoft.
Last modified on 2008-04-27 20:14
I was tagged :)Posted by Nilesh Mehta in
Just found out I was tagged by my friend Bob Fox . For all those who don't know me much yet, here's a little something about me:
1. Born and brought up in Mumbai (Bombay), India. Just as lively as NYC and great crowd. 2. I love singing and almost went on my way to become a singer. Lucky me, I found computers at the right time 3. I am a really lively person and love to laugh a lot. I love sports, especially Volleyball and cricket. I will watch a lot of football too..and the superbowl this year was great, however, I wonder where all those great superbowl ads went?? 4. I have a lovely daughter - Prisha (1 year old). She's is a great kid and brings me the most joy in the world. 5. At the end of the day, I just want to be a good person. I hate myself if I ever hurt anyone and try my best to make sure that I always keep the people around me happy. You will see that I have written a lot of useless stuff here and that is because I can't think of many things to write about myself Always thankful to god for giving me some of the best people in this world as my friends. Cheers, nilaish MOSS 2007 and Project Server 2007Posted by Nilesh Mehta in
This was an interesting one. Last week I helped a client install MOSS 2007 and Project Server 2007 in a medium size farm. Interesting project. I was on the phone call for only 10 hours What I find interesting and not sure why Microsoft is going that route is that in order to install Project Server 2007 in a MOSS 2007 server farm, you need to install MOSS 2007 bits and Project Server 2007 bits on all servers in the farm. This is way different from the 2003 versions where in the two could be on separate boxes and still be able to communicate with each other easily. I am not sure if we would have to buy additional licenses from Microsoft in this scenario or not. However, let's just say the project was very interesting and a real challenge to implement. More details to follow up soon. nilaish SharePoint Search Query for UserProfilesPosted by Nilesh Mehta in
Following code shows how to use SQL search for UserProfile properties in SPS 2003. In the code here, I am searching for AccountName, FirstName, LastName, UserName, PreferredName by default. In addition, we are searching for all the public properties that were returned by the Topology Manager for the User Profiles.
The code is part of a web part which has a interface similar to that of the regular SharePoint search, but returns only UserProfile data.
The only important thing to note here that the path for PictureURL is different from the other properties for User Profiles.
The code searches for both Portal content and Non-Portal Content. It also allows you to build query and perform the "Contains" or "Is Exactly" clause for search restrictions.
The last section of the buildQuery function shows how to sort the results returned by Last Name.
This query is then embedded in to an XML as shown in the BuildMSQuery method. Most of the sample code shown around different web sites show how to only build the query but fail to mention how to embed it into an XML for the final search.
public string buildQuery() { string strxml = null;
string[] ssarray = m_SPSelected.Split(';'); if(this.val1.Value.Length > 0 || this.val2.Value.Length > 0 || this.val3.Value.Length > 0) { strxml = "SELECT " + "\"DAV:href\""; strxml += ",\"urn:schemas-microsoft-com:sharepoint:portal:profile:AccountName\""; strxml += ",\"urn:schemas-microsoft-com:sharepoint:portal:profile:FirstName\""; strxml += ",\"urn:schemas-microsoft-com:sharepoint:portal:profile:LastName\""; strxml += ",\"urn:schemas-microsoft-com:sharepoint:portal:profile:UserName\""; strxml += ",\"urn:schemas-microsoft-com:sharepoint:portal:profile:PreferredName\"";
for(int i = 0; i < ssarray.Length - 1; i++) { if ssarray { if(ssarray { strxml += ",\"urn:schemas.microsoft.com:fulltextqueryinfo:" + ssarray } else strxml += ",\"urn:schemas-microsoft-com:sharepoint:portal:profile:" + ssarray } } } strxml += "from ( TABLE Portal_Content..Scope() UNION ALL TABLE Non_Portal_Content..Scope() ) where ";
// Generate the conditions here now: if(val1.Value.Length > 0 && lbclause1.SelectedValue == "Contains") { // First row has "Contains" clause strxml += "(Contains(\"urn:schemas-microsoft-com:sharepoint:portal:profile:" + lbprops1.SelectedValue + "\",'" + SPEncode.HtmlEncode(val1.Value) + "')) "; } else if(val1.Value.Length > 0 && lbclause1.SelectedValue == "Is Exactly") { // First row has "Is Exactly" Clause strxml += " \"urn:schemas-microsoft-com:sharepoint:portal:profile:" + lbprops1.SelectedValue + "\"='" + SPEncode.HtmlEncode(val1.Value) + "' "; }
// Add the AND or OR conditions if { strxml += lbcondition.SelectedValue; }
// Row 2 processing if(val2.Value.Length > 0 && lbclause2.SelectedValue == "Contains") { // Second row has "Contains" clause strxml += "(Contains(\"urn:schemas-microsoft-com:sharepoint:portal:profile:" + lbprops2.SelectedValue + "\",'" + SPEncode.HtmlEncode(val2.Value) + "'))"; } else if(val2.Value.Length > 0 && lbclause2.SelectedValue == "Is Exactly") { // Second row has "Is Exactly" Clause strxml += " \"urn:schemas-microsoft-com:sharepoint:portal:profile:" + lbprops2.SelectedValue + "\"='" + SPEncode.HtmlEncode(val2.Value) + "' "; }
// Add the AND or OR conditions between second row and third row if { strxml += lbcondition.SelectedValue; }
// Row 3 processing if(val3.Value.Length > 0 && lbclause3.SelectedValue == "Contains") { // Third row has "Contains" clause strxml += "(Contains(\"urn:schemas-microsoft-com:sharepoint:portal:profile:" + lbprops3.SelectedValue + "\",'" + SPEncode.HtmlEncode(val3.Value) + "'))"; } else if(val3.Value.Length > 0 && lbclause3.SelectedValue == "Is Exactly") { // Third row has "Is Exactly" Clause strxml += " \"urn:schemas-microsoft-com:sharepoint:portal:profile:" + lbprops3.SelectedValue + "\"='" + SPEncode.HtmlEncode(val3.Value) + "' "; }
// Added code to sort results by last name strxml += " ORDER BY \"urn:schemas-microsoft-com:sharepoint:portal:profile:LastName\""; return strxml; }
/// <summary> /// Builds an MSQuery with an embedded MSSQLFT query embedded /// for submission to SharePointPS Query Service. /// </summary> /// <param name="keywords">Keywords submitted for search.</param> /// <param name="searchScope">SPS Search scope to filter.</param> /// <returns>MSQuery</returns> public string BuildMSQuery(string queryXml) { if(queryXml == null) return null;
StringBuilder msQuery = new StringBuilder();
// create the main header of the XML string msQuery.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<QueryPacket xmlns=\"urn:Microsoft.Search.Query\" " + "Revision=\"1000\">" + "<Query domain=\"QDomain\">" + "<SupportedFormats>" + "<Format>urn:Microsoft.Search.Response.Document.Document" + "</Format></SupportedFormats>");
// create the actual full-text query msQuery.Append("<Context>" + "<QueryText language=\"en-US\" type=\"MSSQLFT\">" + "<![CDATA[" + queryXml + "]]></QueryText></Context>");
// create the range, page, and number of results to return msQuery.Append("<Range><StartAt>1</StartAt><Count>" + M_MaxReturnResults + "</Count>" + "</Range></Query></QueryPacket>");
return msQuery.ToString(); }
The XML should be passed to the Query or QueryEx function of the search web service: PortalContext ctx = PortalContext.Current; site = ctx.SiteUrl; usrprof.Search.QueryService qs = new usrprof.Search.QueryService(site + "_vti_bin/search.asmx"); qs.Credentials = System.Net.CredentialCache.DefaultCredentials; strresults = qs.Query(queryXml); results = qs.QueryEx(queryXml); CheckBox List in Custom ToolPart PanePosted by Nilesh Mehta in
SharePoint In the same web part that I was building, I had to come up with a way to generate a CheckBox List in a ToolPart Pane. All the search I performed on "Google" showed me how to implement a Textbox control in ToolPart pane and some showed how to implement a single CheckBox or a Drop Down List. I spent some time looking in to this but was not able to find a straight solution.
I ended up implementing a CheckBox List by storing and retrieving values from a string array as shown below:
using System; using System.Web; using System.Data; using System.Collections; using System.Reflection; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using Microsoft.SharePoint; using Microsoft.SharePoint.Utilities; using Microsoft.SharePoint.Portal; using Microsoft.SharePoint.WebPartPages; using Microsoft.SharePoint.Portal.UserProfiles; using Microsoft.Win32;
namespace ngenious { /// <summary> /// Description of the toolpart. Override the GetToolParts method in your WebPart /// class to invoke this toolpart. To establish a reference to the Web Part /// the user has selected, use the ParentToolPane.SelectedWebPart property. /// </summary> public class ProfileToolPart: Microsoft.SharePoint.WebPartPages.ToolPart { private bool savedState = false; private CheckBoxList cbl;
string svrname = ""; string strerr = ""; /// <summary> /// Constructor for the class. /// </summary> public ProfileToolPart() { this.Title = "Profile Properties Selection"; this.FrameState = FrameState.Minimized; getServerName(); }
public override void ApplyChanges() { try { ngenious.profile prof1 = (ngenious.profile)this.ParentToolPane.SelectedWebPart;
if(!savedState) { prof1.m_PPSelected = "";
base.ApplyChanges(); ToolPane tp = this.ParentToolPane; WebPart myWP = (ngenious.profile)tp.SelectedWebPart; for(int i = 0;i < cbl.Items.Count;i++) { if(cbl.Items prof1.m_PPSelected += cbl.Items } cbl.EnableViewState=true; this.SaveViewState(); ChildControlsCreated = false; EnsureChildControls(); savedState=true; } } catch(Exception ex) { } } /// <summary> /// If the ApplyChanges method succeeds, this method is called by the ToolPane object /// to refresh the specified property values in the toolpart user interface. /// </summary> public override void SyncChanges() { // Sync with the new property changes here. }
/// <summary> /// This method is called by the ToolPane object if the user discards changes to the selected Web Part. /// </summary> public override void CancelChanges() { }
/// <summary> /// Render this tool part to the output parameter specified. /// </summary> /// <param name="output">The HTML writer to write out to </param> protected override void RenderToolPart(HtmlTextWriter output) { try { //this.EnsureChildControls(); //Assign the web part custom property value to the input control. ngenious.profile prof1 = (ngenious.profile)this.ParentToolPane.SelectedWebPart; cbl.RenderControl(output); output.Write("<BR><input name= '" + "selprops"); output.Write("' type='hidden' value='" + SPEncode.HtmlEncode(prof1.m_PPSelected) + "'><BR>");
if(strerr.Length > 0 ) { output.Write("<BR><input name= '" + "ErrorText"); output.Write("' type='Text' value='" + SPEncode.HtmlEncode(strerr) + "'><BR>"); } } catch(Exception ex) { output.Write("Error: " + ex.ToString()); } }
protected override void CreateChildControls() { try { ngenious.profile prof1 = (ngenious.profile)this.ParentToolPane.SelectedWebPart; // Set the string array with value from existing string for Profile Properties Selected string initialval = prof1.m_PPSelected; string[] sarray = initialval.Split(';'); // Create the CheckBoxList to manage the profile properties selection
cbl = new CheckBoxList(); cbl.EnableViewState = true;
// Create the DataTable that will include the properties from ProfileSchema DataTable dt = new DataTable(); DataRow dr;
dt.Columns.Add(new DataColumn("Name", typeof(string)));
int nret = ContextIsSPS(); // Check to see if we are running in SPS context or WSS // If WSS, then call the getServerName Function and retrive Server Information // Then user the userprofileservices object to GetProfileSchema
if(nret == 1) { // That means we are in SPS Context
// Use TopologyManager to get to User Profile Config Manager // This will allow us to get to list of profile properties and check if it is public or private PortalContext pc = PortalApplication.GetContext();
//initialize user profile config manager object UserProfileConfigManager upcm = new UserProfileConfigManager(pc); Microsoft.SharePoint.Portal.UserProfiles.PropertyCollection pcol = upcm.GetProperties(); IEnumerator enumprop = pcol.GetEnumerator(); while(enumprop.MoveNext()) { // Check to see each properties IsPrivate value; Property prop = (Property)enumprop.Current; if(!prop.IsPrivate) { dr = dt.NewRow(); dr[0] = prop.Name; dt.Rows.Add(dr); } }
DataView dv = new DataView(dt);
cbl.DataSource = dv; cbl.DataTextField="Name"; cbl.DataValueField="Name"; cbl.DataBind();
for(int i = 0; i < sarray.Length - 1;i++) { ListItem liv = cbl.Items.FindByText(sarray liv.Selected = true; }
this.Controls.Add(cbl); } else if (nret == 2) { // That means we are in WSS Context. // Use the servername information, to connect to the userprofileservice // and retrieve Profile Properties using GetProfileSchema usrprof.userprofile.UserProfileService ups = new usrprof.userprofile.UserProfileService("http://" + svrname + "/_vti_bin/UserProfileService.asmx"); ups.Credentials = System.Net.CredentialCache.DefaultCredentials;
usrprof.userprofile.PropertyInfo[] pi = ups.GetUserProfileSchema(); for(int cnt = 0; cnt < pi.Length; cnt++) { dr = dt.NewRow(); dr[0] = pi[cnt].Name; dt.Rows.Add(dr); }
DataView dv = new DataView(dt);
cbl.DataSource = dv; cbl.DataTextField="Name"; cbl.DataValueField="Name"; cbl.DataBind();
for(int i = 0; i < sarray.Length - 1;i++) { ListItem liv = cbl.Items.FindByText(sarray liv.Selected = true; }
this.Controls.Add(cbl); }
} catch(Exception exc) { strerr = "Servername: " + svrname + ", " + exc.Message; } }
public void getServerName() { RegistryKey rk = Registry.LocalMachine.OpenSubKey("System\\CurrentControlSet\\Control\\ComputerName\\ComputerName", true); svrname = (string)rk.GetValue("ComputerName");
return; }
/// <summary> /// Returns a Boolean indicating whether we're running in SharePoint Portal Server /// or not. /// </summary> /// <returns>True if we're running in SPS; false otherwise.</returns> public int ContextIsSPS() { Assembly assemblyInstance = null; try { // Try to bind to the Microsoft.SharePoint.Portal assembly. // If it isn't there, we're not in SPS. assemblyInstance = Assembly.LoadWithPartialName("Microsoft.Sharepoint.Portal"); if(assemblyInstance != null) { // We've successfully bound to the assembly, so now let's try to determine // the current PortalContext. System.Type oType = assemblyInstance.GetType("Microsoft.SharePoint.Portal.PortalContext"); PropertyInfo oInfo = oType.GetProperty("Current"); object result = oInfo.GetValue(null, null); if (result == null) { // SPS Installation, but WSS context return 2; } else { // Running in SPS context // To determine SPS site URL: // PropertyInfo oSiteURLInfo = result.GetType().GetProperty("SiteUrl"); // string siteurl = (string)oSiteURLInfo.GetValue(result,null); return 1; } } else { // We couldn't bind to the Portal assembly, so we're not on an SPS box return 0; } } catch (Exception err) { return 0; } finally { assemblyInstance = null; } } } }
While loading data, in the CreateChildControls method, I get a handle to the SelectedWebPart and retrieve the string value of m_PPSelected. I convert this string to a string array. Next I create a data source for the CheckBox List. I will be using a DataTable for this purpose.
The web part was designed to work with both WSS and SPS, hence we will check for ContextIsSPS at this point. There was an article on MSD2D that showed how to implement the ContextIsSPS. We will then retrieve the profile properties accordingly and fill up the DataTable with profile property information. One of the important things to note here is to check how we can retrieve private or public only properties by checking the prop.IsPrivate value: UserProfileConfigManager upcm = new UserProfileConfigManager(pc); Microsoft.SharePoint.Portal.UserProfiles.PropertyCollection pcol = upcm.GetProperties(); IEnumerator enumprop = pcol.GetEnumerator(); while(enumprop.MoveNext()) { // Check to see each properties IsPrivate value; Property prop = (Property)enumprop.Current; if(!prop.IsPrivate) { dr = dt.NewRow(); dr[0] = prop.Name; dt.Rows.Add(dr); } }
We will then attach this data source to the CheckBox List. This will generate check boxes for each property.
Next we will traverse through the string array and compare values with the CheckBox List to see which check boxes should be checked from the last settings.
for(int i = 0; i < sarray.Length - 1;i++) { ListItem liv = cbl.Items.FindByText(sarray liv.Selected = true; }
After this we will add the CheckBox List to the control. This.Controls.add(cbl);
On the other hand, when saving data for changes from the ToolPart Pane, we override the ApplyChanges method as follows:
public override void ApplyChanges() { try { ngenious.profile prof1 = (ngenious.profile)this.ParentToolPane.SelectedWebPart;
if(!savedState) { prof1.m_PPSelected = "";
base.ApplyChanges(); ToolPane tp = this.ParentToolPane; WebPart myWP = (ngenious.profile)tp.SelectedWebPart; for(int i = 0;i < cbl.Items.Count;i++) { if(cbl.Items prof1.m_PPSelected += cbl.Items } cbl.EnableViewState=true; this.SaveViewState(); ChildControlsCreated = false; EnsureChildControls(); savedState=true; } } catch(Exception ex) { } } We will do the opposite here, we will traverse through the CheckBox list and retrieve items that were checked and fill the m_PPSelected variable with the information separated by semi-colon.
Hope this helps someone.
Ciao, nilaish RenderWebPart and ToolPart PanePosted by Nilesh Mehta in
Recently when I was working on a web part, I ran across a small problem. I was writing a custom ToolPart Panes and my code seemed to work properly, but when I tried viewing my ToolPart it would appear all weird on the screen. I was at some point able to access all the properties in my ToolPart but the screen would look completely different. After some working through the code, I found out that the HTML that is used in the RenderWebPart method is related to the HTML on the ToolPart Pane. My HTML in the RenderWebPart method was incomplete and hence it was messing up the ToolPart Pane. I found that weird and completely wrong since the ToolPart Pane shows up in a different frame on the same page and would not have thought that they were related. Anyways, something to keep in mind when writing web parts again. nilaish SharePoint Recurring EventsPosted by Nilesh Mehta in
Well, it seems no one's really done much work on how to get expanded recurring events and how to retrieve that information using the SharePoint Object Model or Web Services
And here's the reason why: SharePoint Recurring Events are similar to Outlook Recurring Events in their logic which would be really difficult to parse through because of the combinations that are available.
This is from the WSS SDK. There has to be a way to retrieve this information because Microsoft has a view associated with the Events List that shows expanded recurring events in details (Every instance). I am going to keep working at it and will post an article as soon as I find out the solution. Look out for that soon. Ciao, nilaish My First EntryPosted by Nilesh Mehta in
Welcome to Nilesh Mehta's blog. This is my first post on this site. Originally I used to write at www.sharepointblogs.com/nilaish. However, after they had a site issue, I was not able to restore my blog on that site. I was lucky enough to have been able to retrieve my posts from there, so I will be able to write them back here and hopefully be able to add a few more ones here. nilaish Last modified on 2008-02-18 18:28
(Page 1 of 1, totaling 9 entries)
|
Calendar
QuicksearchCategoriesSyndicate This BlogBlog Administration |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Powered by Serendipity 1.2.1.
Design by Carl Galloway.

