Microsoft Technology, .Net, BizTalk, Sharepoint & etc.

Liedong(Ken) Zheng, Senior SharePoint Developer at SIMPLOT

Posts Tagged ‘Sharepoint 2007’

Infopath cannot find access the specified web service descript

Posted by ken zheng on October 20, 2009

I saw this error when my infopath form trying to access web service in the SharePoint “_vti_bin/xxx/”. To solve the problem, open your iis and go to your sharepoint web -> _vti_bin then make sure xxx is a application not a folder,.

Posted in Sharepoint | Tagged: , | Leave a Comment »

Code to create a SharePoint list with predefined permission

Posted by ken zheng on October 19, 2009

This is just a sample code for me to create a list with a predefined permission

private void SetPermissionsForTheList(SPList selectedList)
{
          // breaks the inheritance from the parent
         selectedList.BreakRoleInheritance(true);

		 //removes all the permissions from the list, except for 'site - admins'

         while (selectedList.RoleAssignments.Count > 0)
                selectedList.RoleAssignments.Remove(0);

         if (selectedList.RoleAssignments.Count == 0)
         {
            // get the defined site admins group
               SPGroupCollection groupCollection = selectedList.ParentWeb.SiteGroups;
              SPGroup group = groupCollection["Site - Admins"];

            // get the full access role definition
              SPRoleDefinitionCollection roleDefCollection = selectedList.ParentWeb.RoleDefinitions;
              SPRoleDefinition roleDefinition = roleDefCollection [0];

			// create a role assignment based on the site admin group
            // and bind to the full access role definition
            SPRoleAssignment roleAssignment = new SPRoleAssignment((SPPrincipal)group);
            roleAssignment.RoleDefinitionBindings.Add(roleDefinition);
            selectedList.RoleAssignments.Add(roleAssignment);
         }
}

Posted in Sharepoint | Tagged: , | Leave a Comment »

Logging levels in Sharepoint and STSADM

Posted by ken zheng on September 17, 2009

I just found on our Front End Servers where there are no trace logs under 12\LOGS. The log files are there but without any message inside.

‘This gives you the current settings
stsadm.exe -o listlogginglevels

Run this before doing any changes on a machine. It’s always good to know the original settings before making changes.

‘This set the logging to Verbose / Error.
stsadm -o setlogginglevel -tracelevel Verbose -windowslogginglevel Error

//full path
“C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\stsadm” -o setlogginglevel -tracelevel Verbose -windowslogginglevel Error

Posted in Uncategorized | Tagged: , | Leave a Comment »

Add Webpart zone on Masterpage in SharePoint

Posted by ken zheng on July 28, 2009

You know you can’t add a webpart zone into Master page directly, but there is tricky you can do it.

Just add

<asp:ContentPlaceHolder id="WeatherPart" runat="server"></asp:ContentPlaceHolder>

In the pagelayouts, set a control with the same id-name and place your webpartzone inside. You have to do this for every pagelayout that needs a header image in the masterpage. For each page though, there has to be added a image webpart, or whatever webpart you like. So be aware of this, if you use a webpartzone in your masterpage.

<asp:Content ContentPlaceHolderId="WeatherPart" runat="server">
    <div>
	<WebPartPages:WebPartZone runat="server" Title="WeatherPart" ID="WeatherPart"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>
	</div>
</asp:Content>

Posted in Sharepoint | Tagged: , | 1 Comment »

Hide Action/Setting Menu from SharePoint List

Posted by ken zheng on May 7, 2009

Add below Javascript to a Content Editor Web Part on your List page, (Below your List Web Part) it will hide the both menus.

    <script>
        function HideDiv(name) {
            var div = document.getElementsByTagName('div');
            for (var i = 0; i < div.length; i++) {
                var str = div[i].id;
                if (str.indexOf(name) >= 0) {
                    var viewInExplorer = div[i];
                    if (viewInExplorer != null) {
                        if (viewInExplorer.parentNode != null)
                            viewInExplorer.parentNode.removeChild(viewInExplorer);
                    }
                }

            }

        }

        HideDiv("ListActionsMenu");
        HideDiv("ListSettingsMenu");

    </script>
</script>

Posted in JavaScript, Sharepoint | Tagged: | 1 Comment »

Hide the “View All Site Content” Quick Launch Link

Posted by ken zheng on January 7, 2009

To hide this link from all but those users with full control over a WSS site, open the site master page in SharePoint Designer and find the SPSecurityTrimmedControl element that contains a div with class ms-quicklaunchheader. The quickest route to this is to view the page in split view, and click on the “View All Site Content” link in the design pane.

The PermissionsString attribute of the SPSecurityTrimmedControl element determines what users can view this content. Change the value of this attribute to ManageWeb and only those users with rights to perform all admin tasks on the site will then be able to see the link on all pages in the site.

See this page for a list of all the possible permission string values.

All WSS templates that are also included in MOSS (including pages) actually inherit their setting from the System Master Page setting, not the Site Master Page setting. The Site Master Page is not used. Only in MOSS-specific templates, such as a Publishing site, is there Site Master Page usage and System Master Page usage. So to fix this, from the home page Master page settings page, select ‘System Master Page’ select the master page you want and check the ‘Reset all subsites’ option.

Here is the feature Mark Wagner wrote to hide the View All Content Link.
I also add some extra to hide the DIV box and Receyle Bin box. What you need to do is add
.ms-quicklaunchheader
{
display:none;
}
.ms-recyclebin
{
display:none;
}
into VASC-core.css
Here is the wsp file and vs2008 source code.

Posted in Sharepoint | Tagged: , | 1 Comment »

Internet presence scenario

Posted by ken zheng on October 20, 2008

If you are a business decision maker, system or solution architect, IT manager, site manager, Web developer, or Web designer, this content will help you envision the entire process of planning and implementing both an Internet presence site based on SharePoint Server 2007 and the infrastructure and operations necessary to host and support it in an enterprise. It outlines the steps for site-related and infrastructure-related tasks in an interwoven manner, to suggest a useful order in which to coordinate tasks across the Infrastructure and Site-development teams.

Here is a link to the scenario content and here is a link to the downloadable poster.

Posted in Sharepoint | Tagged: | Leave a Comment »

Office SharePoint Server 2007 Technical Library in Compiled Help format

Posted by ken zheng on October 19, 2008

This downloadable CHM is a copy of content in the Microsoft Office SharePoint Server 2007 technical library. The CHM is current as of the date above. You can download it from http://www.microsoft.com/downloads/details.aspx?FamilyID=ba006584-711d-4ce7-9e1f-181aedf6434a&DisplayLang=en

Posted in Sharepoint | Tagged: | Leave a Comment »

WSS – How to get site size? Site collection site? Workspace site?

Posted by ken zheng on October 12, 2008

By UI:

Go to Site Actions >Site Settings(from your root site > Site Collections Admin > Usage Summary..
another method would be running the command line tool STSADM ENUMSITES (which is found here in MOSS07:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\ by default):

STSADM.exe -o enumsites -url htt:// YOURSITENAMEHERE > SiteList.txt

The results of the ENUMSITES in the SiteList.txt file will look like this:

Not very granular but quick and easy.

Posted in Sharepoint | Tagged: | Leave a Comment »

Creating a Site Collection in a New Content Database

Posted by ken zheng on October 10, 2008

There are two methods of getting around this. In the first method, the administrator goes to all Content Databases (SharePoint Central Admin – Application Management Tab – Content Databases) and takes the databases ‘offline’. Note that simply taking the databases offline does not affect user functionality; it only dissallows new Sites from being created in the specific Content Database. Once all Content Databases except for the one desired are taken offline, creating a new Site Collection will force that Site Collection to be created in the one you want.

If the databases aren’t created in advance, there is an even easier way to do this, by using the –createsiteinnewdb flag with the STSADM tool. The STSADM tool (located on web front-ends in the \program files\common files\microsoft shared\web server extensions\12\bin folder) is a fantastic administrative tool that performs a myriad of administration with SharePoint. In this case, it allows you to create a new Site Collection within a new Content Database. The following Syntax illustrates one example:

stsadm -o createsiteinnewdb -url http://docs.companyabc.com/dept/hr -owneremail SharePoint@companyabc.com -ownerlogin COMPANYABC\SPAdmin -sitetemplate sts -title “Human Resources” -databaseserver SERVER1 -databasename “HR-Content-DB”

In this example, a new site collection is created at the URL http://docs.companyabc.com/dept/hr. The Site Collection Owner is set to COMPANYABC\Spadmin and the Site Collection owner email is set to SharePoint@companyabc.com. The default team site template is used to create the site (the template is simply named ‘sts’, without the quotes.) The database server is SERVER1 and the name of the database created is HR-Content-DB.

Using this concept, you can construct a SharePoint environment that will scale quite nicely, as content is distributed across multiple databases. In addition, If you need to scale to multiple database servers, it simply involves moving content databases to the new server and updating the location in SharePoint.

Posted in Sharepoint | Tagged: , | 7 Comments »