Thursday, February 2, 2012

Delegate Control to Inject Google Analytics in MOSS

Hi Guys,

i want to load js for Google analytics for some site and don't want to load for some site so thinking of doing this using delegate control so users can control through feature activation and deactivation.i did something like this for banner image so will this approch work to load js too ?

if there is other way please advise

Thanks

Ronak

Reply

You can opt for 2 set of master pages. One without scripts included, the other one having the Google Analytic implementation

 

Reply 2

Guys,

I am trying to add JS in Master page using Delegate Controls but its not working.here is code i have written.

Please advise

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
namespace WSPBuilderProject1.SharePointRoot.Template.ControlTemplates.PhilaGov
{
public partial class PhilaGovGA : UserControl {
protected void Page_Load(object sender, EventArgs e) {
string _url = SPContext.Current.Web.Url;
}
protected override void CreateChildControls() {
base.CreateChildControls();
this.Controls.Add(new LiteralControl(@"<script type='text/javascript'>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '#12323232']);
_gaq.push(['_trackPageview']);
</script>"));
}

}
}


 

Once i enable feature i dont see this code in head section of master page.

Please advise

 

Thanks

Ronak

Friday, January 20, 2012

ResolvePrincipal

Hi

 

I am trying to ResolvePrincipal using People.asmx in two seprate farms. Both farms are single server farms with same configuration . Both farms target the same AD for user information. End point of AD being use din both the farms are the same .

But one one server it takes average 3.5 seconds to Run this web service method, but on the other it takes 43 seconds.

 

What could be the reason behind ?

Reply 1:

Check out a network trace using the tool Netmon.

http://www.microsoft.com/download/en/details.aspx?id=4865




Varun Malhotra

Wednesday, December 7, 2011

SharePoint 2010 | User Profiles | Recent Activities

Hi

While querying user profile changes we can get changes upto last 14 days.

Now,I want to know about recenet activities web part which shows user profile edits by the user. Up to which point in the past , it shows the user profile changes as recent activities ?

I need to know the duration (in days) in past for which the changes in user profile are reflected as recent activities on page : http://<server>/my/Person.aspx?accountname=domain\AccountID

Reply 1

Helo Heamntrhtk,

 

Check on this site you can configure it: http://sharepointsolutions.blogspot.com/2010/11/sharepoint-2010-social-networkingpart-3.html

Under section:"Timer Jobs Required"

 

The following are listed in the webpart:

Rating, blog, tag, like, ..

Activity Feeds are an ongoing record of a user’s activities through the day (or for whatever time period in which they choose to update the feed). There are two sections of Activity feed.

· My Activities - My Profile > Recent Activities

· Consolidated - My Newsfeed (Activities which track)

These two sections are like two sides of a conversation. Both are depending on Activity Feed timer job.

Kr, Gokan

 

Reply 2

Only the following activities will be displayed in the recent activities.

Rating, Tagging, new blog post and so on.

http://blogs.msdn.com/b/spses/archive/2011/02/05/social-computing-part-3-activity-feeds-social-ratings-tags-and-notes.aspx

 




Wayne Fan

How to exclude items from Search Result page?

in sharepoint 2010, there is an option to remove a url from search results immidiately, corresponding crawling rules/ exclude rules are set automatically

And the that specific content does not get crawled.

 

Otherwise go for Crawl exclude rules directly.

Tuesday, August 9, 2011

The user does not exist or is not unique FBA while adding AdGroup to siteGroup SharePoint 2010

Hi

I tried to add an ADGroup/FBARole to  site  group . In 2 ways:

1 is AddUser(SPUser user);

2nd is AddUser(string loginName, string email, string name, string notes)

code for 1st option:

SPUser cntrSubSiteUser = CreateUser(Constants.C_FBA_AUTHENTICATION_GROUP_PREFIX + RoleProvider + Constants.C_AUTHENTICATION_PIPE + ADgroup, "", ADgroup, "", web.Site);//loginname in format in format c:0-.f|roleproviderName|pp 1001 siteGroup.AddUser(cntrSubSiteUser);

siteGroup.Update();

and the createuser function is like;

private static SPUser CreateUser(string strLoginName, string strEMail, string strName, string strNotes, SPSite spSite) { SPUser spReturn = null; SPRoleAssignment spRoleAssignment = new SPRoleAssignment(strLoginName, strEMail, strName, strNotes); SPRoleDefinition spSPRoleDefinition = spSite.RootWeb.RoleDefinitions["Read"]; spRoleAssignment.RoleDefinitionBindings.Add(spSPRoleDefinition); spSite.RootWeb.RoleAssignments.Add(spRoleAssignment); //Update site spSite.RootWeb.Update(); spReturn = spSite.RootWeb.AllUsers[strLoginName]; return spReturn; }

 

for the second option code is like:- siteGroup.AddUser(Constants.C_FBA_AUTHENTICATION_GROUP_PREFIX + RoleProvider + Constants.C_AUTHENTICATION_PIPE + ADgroup, "", ADgroup, "");//Login Name in format c:0-.f|amsurgrole|pp 1001

siteGroup.Update();

 

 

 

Now lets come to the problem:

On 1 of our dev servers it works fine. But on production we get the error: The user does not exist or is not unique

However by UI, We can add this FBA Role  to any group.

 

please help.

 

Reply 1


hi

 

we have got the solution.

 

we are adding user in group for site 1( on web app 1) from site 2 ( on web app 2) code.  web app 1 is FBA .  site 2 is normal windows site.

in 2007 this code works fine

 

but for sharepoint 2010, we need to give entries for roleprovider and membership provider in web application 2 (admin web app) web.config  also.

                                                                      Reply 1.1


 I  am also getting the same exception. I am doing everything on a single sharepoint application

[SPException: The user does not exist or is not unique.]

 

Can you please point out, what are the other scenarios for the exception to happen?

Reply 1.1.1

did u also do ensure user ? also make sure user exists in ad/ ur membership provider

Reply 1.1.1.1

when extending the application it named the membership provider wrongly, hence the error is caused. Thanks for all the replies. Now the problem is solved.

Tuesday, June 21, 2011

Few of the SharePoint Sites not accessible outside server

Hi

 

Few of my sharepoint sirtes do not open outside the server. Others are working fine. Did you faced such issue in past ?

I verified almost every setting . All the settings on both type of web applications are same.

Reply : 

It was due to firewall settings on the server.

Tuesday, June 14, 2011

SharePoint disable loopback check | Specify Host Names

A number of errors related to authentication failure are reported with SharePoint 20xx

You can try disable loopback check  or Specify host names based on how much you can compromise on security front.

Method 1: Specify host names (Preferred method if NTLM authentication is desired)

To specify the host names that are mapped to the loopback address and can connect to Web sites on your computer, follow these steps:

  1. Set the


DisableStrictNameChecking
registry entry to 1.

2. Click Start, click Run, type regedit, and then click OK.

3. In Registry Editor, locate and then click the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
4. Right-click MSV1_0, point to New, and then click Multi-String Value.
5. Type BackConnectionHostNames, and then press ENTER.
6. Right-click BackConnectionHostNames, and then click Modify.
7. In the Value data box, type the host name or the host names for the sites that are on the local computer, and then click OK.
8. Quit Registry Editor, and then restart the IISAdmin service.

 
Method 2: Disable the loopback check (less-recommended method)

The second method is to disable the loopback check by setting the DisableLoopbackCheck registry key.

To set the DisableLoopbackCheck registry key, follow these steps:
1. Set the
DisableStrictNameChecking
registry entry to 1.
2. Click Start, click Run, type regedit, and then click OK.
3. In Registry Editor, locate and then click the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
4. Right-click Lsa, point to New, and then click DWORD Value.
5. Type DisableLoopbackCheck, and then press ENTER.
6. Right-click DisableLoopbackCheck, and then click Modify.
7. In the Value data box, type 1, and then click OK.
8. Quit Registry Editor, and then restart your computer.

                                                 or
$regKeyPath = "HKLM:\System\CurrentControlSet\Control\Lsa"
$key = "DisableLoopbackCheck"
New-ItemProperty -Path $regKeyPath -Name $key -Value "1" -PropertyType dword


Reference :http://support.microsoft.com/kb/896861