 |
| Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XsnLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | FileType | xsn | 255 | | Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | ProgId | InfoPath.Document | 255 | | Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | ProgId | InfoPath.Document.2 | 255 | | Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | ProgId | InfoPath.Document.3 | 255 | | Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | ProgId | InfoPath.Document.4 | 255 | | View in Web Browser | /_layouts/images/ichtmxls.gif | /Blogs/Patrick/_layouts/xlviewer.aspx?listguid={ListId}&itemid={ItemId}&DefaultItemOpen=1 | 0x0 | 0x1 | FileType | xlsx | 255 | | View in Web Browser | /_layouts/images/ichtmxls.gif | /Blogs/Patrick/_layouts/xlviewer.aspx?listguid={ListId}&itemid={ItemId}&DefaultItemOpen=1 | 0x0 | 0x1 | FileType | xlsb | 255 | | Snapshot in Excel | /_layouts/images/ewr134.gif | /Blogs/Patrick/_layouts/xlviewer.aspx?listguid={ListId}&itemid={ItemId}&Snapshot=1 | 0x0 | 0x1 | FileType | xlsx | 256 | | Snapshot in Excel | /_layouts/images/ewr134.gif | /Blogs/Patrick/_layouts/xlviewer.aspx?listguid={ListId}&itemid={ItemId}&Snapshot=1 | 0x0 | 0x1 | FileType | xlsb | 256 |
|
|
| Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XsnLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | FileType | xsn | 255 | | Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | ProgId | InfoPath.Document | 255 | | Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | ProgId | InfoPath.Document.2 | 255 | | Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | ProgId | InfoPath.Document.3 | 255 | | Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | ProgId | InfoPath.Document.4 | 255 | | View in Web Browser | /_layouts/images/ichtmxls.gif | /Blogs/Patrick/_layouts/xlviewer.aspx?listguid={ListId}&itemid={ItemId}&DefaultItemOpen=1 | 0x0 | 0x1 | FileType | xlsx | 255 | | View in Web Browser | /_layouts/images/ichtmxls.gif | /Blogs/Patrick/_layouts/xlviewer.aspx?listguid={ListId}&itemid={ItemId}&DefaultItemOpen=1 | 0x0 | 0x1 | FileType | xlsb | 255 | | Snapshot in Excel | /_layouts/images/ewr134.gif | /Blogs/Patrick/_layouts/xlviewer.aspx?listguid={ListId}&itemid={ItemId}&Snapshot=1 | 0x0 | 0x1 | FileType | xlsx | 256 | | Snapshot in Excel | /_layouts/images/ewr134.gif | /Blogs/Patrick/_layouts/xlviewer.aspx?listguid={ListId}&itemid={ItemId}&Snapshot=1 | 0x0 | 0x1 | FileType | xlsb | 256 |
|
|
| Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XsnLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | FileType | xsn | 255 | | Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | ProgId | InfoPath.Document | 255 | | Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | ProgId | InfoPath.Document.2 | 255 | | Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | ProgId | InfoPath.Document.3 | 255 | | Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | ProgId | InfoPath.Document.4 | 255 | | View in Web Browser | /_layouts/images/ichtmxls.gif | /Blogs/Patrick/_layouts/xlviewer.aspx?listguid={ListId}&itemid={ItemId}&DefaultItemOpen=1 | 0x0 | 0x1 | FileType | xlsx | 255 | | View in Web Browser | /_layouts/images/ichtmxls.gif | /Blogs/Patrick/_layouts/xlviewer.aspx?listguid={ListId}&itemid={ItemId}&DefaultItemOpen=1 | 0x0 | 0x1 | FileType | xlsb | 255 | | Snapshot in Excel | /_layouts/images/ewr134.gif | /Blogs/Patrick/_layouts/xlviewer.aspx?listguid={ListId}&itemid={ItemId}&Snapshot=1 | 0x0 | 0x1 | FileType | xlsx | 256 | | Snapshot in Excel | /_layouts/images/ewr134.gif | /Blogs/Patrick/_layouts/xlviewer.aspx?listguid={ListId}&itemid={ItemId}&Snapshot=1 | 0x0 | 0x1 | FileType | xlsb | 256 |
|
|
|
 |
|
|
|
|
|
U2U Blog Center > Patrick Tisseghem's Blog [MVP SharePoint] > Categories
|
6/06/2008Recently I did a webcast on the different steps that are required to prepare your SharePoint Development Server for hosting Silverlight 2 applications in the SharePoint sites. I also went through these steps yesterday during my session here. It is targetting beta 1 and beta 2 will be available later today so you might have to tweak the steps a bit. I'll try to get an update on that done in the next coming weeks. The webcast is available on http://www.codeplex.com/SL4SP/Release/ProjectReleases.aspx?ReleaseId=14118. 30/05/2008Very often when working with a team of developers you build not one but multiple .NET assemblies containing Web Parts that are deployed in the private application folder (BIN) of the IIS Web Application. Deploying in the BIN folder results in the assemblies depending on the trust level configured by the administrators in the web.config that is in place for the IIS Web Application. Setting this trust level to FULL will solve all of the possible security problems for the deployed assemblies but this is not directly a good choice in a production environment. In most cases, the trust level is set to WSS_Minimal and best practice for a developer is to include in the manifest.xml, which is part of the SharePoint Solution (the .WSP), a blob of CAML asking the administrator to grant the required permissions for the proper working of the Web Part. Daniel Larson has a good overview of the steps that are required. Here is a sample of a possible custom CAS entry in the manifest.xml where the Web Part requests access to the SharePoint object model and the permission to communicate with a Web Service. 1: <CodeAccessSecurity> 2: <PolicyItem> 3: <PermissionSet class="NamedPermissionSet" version="1" 4: Description="My webpart's permission set"> 5: <IPermission class="AspNetHostingPermission" version="1" 6: Level="Minimal"/> 7: <IPermission class="SecurityPermission" version="1" 8: Flags="Execution" /> 9: <IPermission version="1" Unrestricted="True" 10: class="Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, 11: Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> 12: <IPermission class="System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, 13: PublicKeyToken=b77a5c561934e089" Unrestricted="True" 14: version="1"> 15: <ConnectAccess> 16: <URI uri="$OriginHost$"/> 17: <URI uri="http://springfield:95/webservices/.*"/> 18: </ConnectAccess> 19: </IPermission> 20: </PermissionSet> 21: <Assemblies> 22: <Assembly Name="WeatherwebPart" Version="1.0.0.0" PublicKeyBlob="0x002400000480000094000 23: 00006020000002400005253413100040000010001000DAF8ED8D945CD2ABB2EE7953A6039B791A725F11B4588AC6D70B3E06 24: 48F955E9ED4C3C43CB044B8B0E8A6FF4D4FFBE9E3B9297D45F688A7264534E12414E17539305207EC961DA94DF294E7722CC 25: D9BDBFC95A896E996F57156705D281EC39280BD604E87724556AF5807D146963F19F5B43DB69E1F22695463153A553260D2" /> 26: </Assemblies> 27: </PolicyItem> 28: </CodeAccessSecurity>
Note that the Assembly element is set to the full details of the Web Part assembly. You can also have only the name of the assembly defined here (not including the full key). When the solution is deployed in the farm, the targeted IIS Web Application web.config will have the trust level set to a custom config file with the content of the WSS_Minimal.config (assuming that was the level before the deployment) and the contents you see above.
At U2U we are currently creating new Features for administrators working with SharePoint solutions. For example, we have a page like this that shows the full details of the solution in the SharePoint 3.0 Central Administration, showing also the custom CAS policy that is requested in the WSP. (More on this new project later)
Assume now that there is the request to create 20 more solutions like this and these assemblies also need specific permissions. It is not such a good idea to come up for each of them with their own CAS policies like shown above. If you sign them all with the same SNK file, you have enough with one configuration containing all of the permissions for all of the individual assemblies that are required. You could push this out in the farm with a solution dedicated to this with only the custom permission settings. The Assembly element then should only contain the PublicKeyBlob, not anymore a Name and a Version attribute.
1: <Assemblies> 2: <Assembly PublicKeyBlob="0x002400000480000094000 3: 00006020000002400005253413100040000010001000DAF8ED8D945CD2ABB2EE7953A6039B791A725F11B4588AC6D70B3E06 4: 48F955E9ED4C3C43CB044B8B0E8A6FF4D4FFBE9E3B9297D45F688A7264534E12414E17539305207EC961DA94DF294E7722CC 5: D9BDBFC95A896E996F57156705D281EC39280BD604E87724556AF5807D146963F19F5B43DB69E1F22695463153A553260D2" /> 6: </Assemblies>
This is yet another reason to enforce the use of only a few SNK files in your SharePoint development projects and not allow SNK files to be created directly by the developers for each assembly they are signing. 14/02/2008One of the most popular community tools for SharePoint, the SmartPart, is updated again. Jan T. has done it again updating the SmartPart so that you have better support for AJAX and now also support for 64bit environments. Awesome... love this dude :). Read more here and download it from here. 28/11/2007Going through my comments here on the blog, I notice that there are quite a number of comments on CAML-related postings. Here is an interesting one where I decided to call the help of our CAML girl to have a look at them. It will of course cost me a couple of beers, but heck, I do have an answer now  Would it be possible to introduce something like Today - 5 (days ?) Answer: If you want to work with the date of today, you could use the syntax <Today /> and if you want to do simple calculations f.e. adding or subtracting a certain number of days of today’s date you could make use of the syntax <Today OffsetDays=”5” />. In a content query web part you could integrate a query like the following: <WHERE> <GE> <FieldRef Name="StartDate"/> <Value Type="DateTime"><Today OffsetDays=5 /></Value> </GE> </WHERE> If you are writing code, you could build and execute your CAML query as follows: SPSite site = new SPSite("http://wss.u2ucourse.com"); SPWeb web = site.OpenWeb(); SPList list = web.Lists["Course Calendar"]; string querystring = "<WHERE><GE><FieldRef Name=\"StartDate\"/>" + "<Value Type=\"DateTime\"><Today OffsetDays=\"5\" /></Value></GE></WHERE>"; SPQuery query = new SPQuery(); query.Query = querystring; DataTable table = list.GetItems(query).GetDataTable(); In case of more complex calculations on dates, you could make use of SPUtility.CreateISO8601DateTimeFromSystemDateTime (as specified in previous post) in combination with the different calculation methods on the DateTime data type. For completeness, I integrate a code example based on the previous example: SPSite site = new SPSite("http://wss.u2ucourse.com"); SPWeb web = site.OpenWeb(); SPList list = web.Lists["Course Calendar"]; string datestring = Microsoft.SharePoint.Utilities.SPUtility.CreateISO8601DateTimeFromSystemDateTime (DateTime.Today.AddDays(5)); string querystring = "<WHERE><GE><FieldRef Name=\"StartDate\"/>" + "<Value Type=\"DateTime\">" + datestring + "</Value></GE></WHERE>"; SPQuery query = new SPQuery(); query.Query = querystring; DataTable table = list.GetItems(query).GetDataTable(); As a side note, build such queries will be possible with the new version of the CAML Query Builder feature that will be released soon. 23/10/2007
This week I am visiting Denmark again. Lovely place, a bit cold but knowing that next week I'll be in Cyprus and then a week of Barcelona I can take it. I am delivering my favorite course (the advanced SharePoint dev course) One of the students at WM-Data asked me about the steps to start with the server farm, loop over all of the servers, get all of the IIS Web applications running on that server and from there looping over all of the site collections and possible the individual sites. Here is a small app I have created as a demonstration
Here are the steps:
- Start by getting a reference to the SPFarm either the local or joined farm. You can even connect to a remote farm if you provide the connection string to the configuration database.
SPFarm myFarm = SPFarm.Local;
- Connect to or loop over the servers part of the farm.
SPServer myServer = myFarm.Servers["springfield"];
- Loop over all of the services running on that server represented in the object model as a SPServiceInstance type. The TypeName property is a good one to show since the DisplayName property is often an empty string.
listBox1.DisplayMember = "TypeName"; foreach (SPServiceInstance servinst in myServer.ServiceInstances) { listBox1.Items.Add(servinst); }
- One of these services is the Windows SharePoint Services Web Application. Grab it and cast the Service property to the SPWebService:
SPServiceInstance servinst = (SPServiceInstance)listBox1.SelectedItem;
if (servinst.Service is SPWebService) { SPWebService serv = (SPWebService)servinst.Service;
- Next retrieve the IIS Web Applications under the control of this service
listBox2.DisplayMember = "DisplayName"; foreach (SPWebApplication webapp in serv.WebApplications) { listBox2.Items.Add(webapp); } }
- And then you can work with your site collections:
SPWebApplication webapp = (SPWebApplication)listBox2.SelectedItem;
listBox3.Items.Clear(); listBox3.DisplayMember = "Url"; foreach (SPSite sitecol in webapp.Sites) { listBox3.Items.Add(sitecol); }
28/08/2007
Developers can, when they are in need to see the full ASP.NET error within the SharePoint pages, turn on the StackTrace and the turn off the CustomErrors within the web.config of the IIS Web Application they are using to test out the work.
It is possible to programmatically do this by working with the SPWebConfigModification class within the Microsoft.SharePoint.Administration namespace. This is a very useful class if you want to dynamically (that is within code - e.g. within your Feature event receivers or custom installation applications). You have to option to add/modify/delete sections, child elements and attributes. To turn the web.config in dev mode and back you'll work with the following code: private void ToggleDevMode(string url, bool flag)
{
SPSite sitecol = new SPSite(url);
SPWebApplication iiswebapp = sitecol.WebApplication;
SPWebConfigModification webcnfg1 = new SPWebConfigModification();
webcnfg1.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureAttribute;
webcnfg1.Path = "configuration/SharePoint/SafeMode";
webcnfg1.Name = "CallStack";
if (flag)
webcnfg1.Value = "True";
else
webcnfg1.Value = "False";
SPWebConfigModification webcnfg2 = new SPWebConfigModification();
webcnfg2.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureAttribute;
webcnfg2.Path = "configuration/system.web/customErrors";
webcnfg2.Name = "mode";
if (flag)
webcnfg2.Value = "Off";
else
webcnfg2.Value = "On";
iiswebapp.WebConfigModifications.Add(webcnfg1);
iiswebapp.WebConfigModifications.Add(webcnfg2);
iiswebapp.Farm.Services.GetValue<SPWebService>().ApplyWebConfigModifications();
sitecol.Dispose();
}
23/08/2007
This week I am teaching an advanced SharePoint 2007 development course here in Brussels (next one is end of September). It's a lot of fun to go through all the material and I have invested a lot of energy in updating the lab material to provide an end-to-end scenario for the students to work out. All Feature-based of course; avoiding as much as possible to create stuff using the browser. Next week I'll teach the same course in Norway. It will be a busy week since I have more than 30 participants. And we already have a beer-drinking evening planned (of course J).
A student came with an interesting question regarding CAML queries: "If we execute a CAML query using SPQuery, can I have the items from subfolders included in the results returned?".
By default, only items out of the root folder are returned but there is a property you can set to get the results out of a folder (or all of them if you write a small loop).
SPSite site = new SPSite("http://moss.litwareinc.com/testsite"); if (site != null) { SPWeb web = site.OpenWeb(); foreach (SPList docLib in web.Lists) { if (docLib.Title == "Shared Documents") { foreach (SPFolder subFolder in docLib.RootFolder.SubFolders) { SPQuery query = new SPQuery(); query.Query = "<OrderBy><FieldRef Name='Title'/></OrderBy>"; query.Folder = subFolder; System.Data.DataTable table = docLib.GetItems(query).GetDataTable(); } } } }
Thanks CAML girl for the suggestion J
Update: Michael Hofer has a good posting showing how to recursively get the items out of the folders using a CAML query. 9/08/2007
When you build a custom portal provisioning script, you have to uniquely identify your template for WSS. Many times I see that people are working with numeric IDs and the guideline is that you start from 10000 to identify your own custom templates. But there is no guarantee that the number you assign here will ultimately be unique on the front-end Web Servers since other developers can create definitions also or maybe you are installing templates you download from the community or from 3rd parties.
It is better to just assign a GUID as the value for the ID attribute in the XML. This will make sure your portal template is going to be unique wherever you deploy it.
<Templates xmlns:ows="Microsoft SharePoint"> <Template Name="U2UPortal" ID="{88F4E732-4F7C-48ab-9E5A-1DFD4A69751E}">
<Configuration ID="0" Title="U2U Portal Kit" Hidden="FALSE" ImageUrl="/_layouts/1033/images/IPPTU2U.gif" Description="This template can be used to create a starter internet site for U2U." ProvisionAssembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ProvisionClass="Microsoft.SharePoint.Publishing.PortalProvisioningProvider" ProvisionData="xml\\u2umanifest.xml" RootWebOnly="TRUE" DisplayCategory="Publishing" VisibilityFeatureDependency="97A2485F-EF4B-401F-9167-FA4FE177C6F6"> </Configuration>
</Template> </Templates> 8/08/2007In the world of Windows SharePoint Services 3.0, the whole concept of Features is super important. I am happy to see the U2U consultants making sure that all of the stuff they build ultimately is packaged as a collection of Features and further on for deployment as a SharePoint solution. If you are not familiar with these concepts have a look at this two-part article, read Ted's book, or follow one of the U2U's SharePoint development courses.
Karine, the CAML girl, has found the time to work out a nice little Feature that lights-up the list settings page with an additional hyperlink letting you jump to a page showing all of the details for the list a developer is interested in. I know I'll use a lot within my courses and my development work. The Feature is available for download over here. Read also Karine's posting on it. 21/06/2007Yes, the 'beast' (as we called it at the end) is out. The idea for this whitepaper started in January with the preparation of a session Mike Fitzmaurice gave at the European SharePoint Conference in Berlin. M & M's input (Mike Fitzmaurice and Mike Ammerlaan) was invaluable for the paper and they constantly pointed out new paths to explore. That's why the beast ended up as a paper split into two parts.
We all understood that the content was going to be important for a lot of folks out there. Mike nicely formulates in a posting on the product team's blog a feeling that we all had during the process and what to expect:
"I'm not saying that everything just became easy (it hasn't), but I *am* saying that everything just became explicit. The paper has recommended practices, examples, etc. Although you still can't upgrade a list/feature/site definition over an old one, this paper will show you how to deprecate the old one and have the new one take over for any newly-created sites/features/lists."
Update of baggage status: Final day here in Sydney. Baggage was on the plane from London to Sydney yesterday. Hopefully I'll get it today since I am leaving tomorrow. Maybe I can just pick it up on my way home again J.
| Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XsnLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | FileType | xsn | 255 | | Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | ProgId | InfoPath.Document | 255 | | Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | ProgId | InfoPath.Document.2 | 255 | | Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | ProgId | InfoPath.Document.3 | 255 | | Edit in Browser | /_layouts/images/icxddoc.gif | /Blogs/Patrick/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser | 0x0 | 0x1 | ProgId | InfoPath.Document.4 | 255 | | View in Web Browser | /_layouts/images/ichtmxls.gif | /Blogs/Patrick/_layouts/xlviewer.aspx?listguid={ListId}&itemid={ItemId}&DefaultItemOpen=1 | 0x0 | 0x1 | FileType | xlsx | 255 | | View in Web Browser | /_layouts/images/ichtmxls.gif | /Blogs/Patrick/_layouts/xlviewer.aspx?listguid={ListId}&itemid={ItemId}&DefaultItemOpen=1 | 0x0 | 0x1 | FileType | xlsb | 255 | | Snapshot in Excel | /_layouts/images/ewr134.gif | /Blogs/Patrick/_layouts/xlviewer.aspx?listguid={ListId}&itemid={ItemId}&Snapshot=1 | 0x0 | 0x1 | FileType | xlsx | 256 | | Snapshot in Excel | /_layouts/images/ewr134.gif | /Blogs/Patrick/_layouts/xlviewer.aspx?listguid={ListId}&itemid={ItemId}&Snapshot=1 | 0x0 | 0x1 | FileType | xlsb | 256 |
|
|
|
|
|
|
|
|