Sunday, February 12, 2012

Get a List of Site Collections in a Web Application in SharePoint

            

               SPWebApplication webApp = SPWebApplication.Lookup(new Uri(“WebApplication URL”));

               foreach (SPSite site in webApp.Sites)
               {
                   radCmbSiteCollList.Items.Add(new RadComboBoxItem(site.Url));
                   site.Dispose();
               }

Get a List of Web Applications in a SharePoint Farm

Code to iterate through all the web applications in a SharePoint Farm         

              SPFarm farm = SPWebService.ContentService.Farm;
               SPWebApplicationCollection webAppColl = SPWebService.ContentService.WebApplications;
               if (webAppColl != null)
               {
                   foreach (SPWebApplication spWebApp in webAppColl)
                   {
                       lst.Items.Add(new ListItem(spWebApp.AlternateUrls[0].Uri.ToString()));
                   }
                   radCmbWebApplications.Items.Insert(0, new RadComboBoxItem(" -- Select a WebApplication -- ", "-1"));

               }

Thursday, October 20, 2011

Behave and Find My Site

Tip:

Assuming you already have Active Directory & Profile Database Synchronization working and your own My Site is flawlessly functioning, you may still get the User Not Found error while trying to assess your esteemed colleagues’ sites. The steps below saved my afternoon (and hopefully yours as well), and I still had daylight left on a warm afternoon for some surfing. Just kidding about the surfing; I don’t even swim.

1.     Open Central Administration.

2.     Under Application Management , click on Manage service applications.

3.     Click on the first User Profile Service.

4.     Under My Site Settings, click on Setup [sic] My Sites.

5.     Under Site Naming Format, change the default option to Domain and user name or User name.

6.     Head to nearest beach and ride the waves. Or learn swimming in some cases.

Monday, August 29, 2011

User cannot be found. at Microsoft.SharePoint.SPUserCollection.get_item(String loginName)


Recently during SharePoint upgrade to SP 2010 we have removed the groups (SharePoint groups and AD groups) in SharePoint, but still the K2 Blackpearl Workflows work with SP 2007 only. So the point of removing the groups was to restrict the users to access other sites with in the site collection and allow access to only specific workflows. so we have added the required access to the users for that site. But when workflows were submitted and while adding the data to the SharePoint list items the workflows got into error state with the message “User cannot be found. at Microsoft.SharePoint.SPUserCollection.get_item(String loginName)”.

Here is the screenshot of those errors:
Actually this workflow will create a list item in the SharePoint List which has some columns with the type of People or Group. So while filling the data into these columns with login names the error is thrown by the workflow. After a call with K2 team we have found that if we add these users for any SharePoint group in that site collection it will work. And we could repair all the errors by adding the users to a group with ‘Contribute without delete’ access. I think it may also work with other permissions levels like read-only.
There may be other causes for this error, but this fixed our workflow errors.
So the bottom line is all the users need to belong to atleast a SharePoint group to be accessed by Blackpearl workflow to fill the People or Group type columns in SharePoint list.

K2.Net 2003: Request failed with HTTP status 401: Unauthorized


As we know there are many steps need top be followed to setup the K2.Net 2003. Each step it has its own importance.If we miss any step in configuration we get a specific error for that. Recently we have tried to move the SharePoint List to a new site collection and updated this URL in string table and submit the workflow. So while creating a new list item the workflow got into error state and the error reads like below (below image). We have given Full Permissions on the site and the list, but none of these things worked. Finally after doing this and that I have found that the service account is not listed under site collection administrators. So I have added the account there and tried to repair and it worked so fine. Thought this will help others. So shared here!
So just you know, the steps required for adding the permissions under site collection:
1. Go to Site Actions
2. Select Modify Site Settings
3. Go to site collection Administration
4. Select Top level Settings (if you see this link under that)
5. Next page, under Users and Permissions section click Site collection administrator
6. The next page will show you the Editor showing people picker (check names image and browse)
7. Add the service account into that.


Hope it helps!!!

Access to XMLHttpRequest at 'from origin has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. .net core angular

Issue: The angular application was getting error from API that the origin has been blocked by CORS policy. Solution: Make sure that the...