I don't know the reason why it took a long time for me to fix the issue in SharePoint 2013. I don't know whether my SharePoint developing skill is down or not and I think I am too old to work as a developer.
My situation is:
Step 1: Backup database of web application in SharePoint 2010
Step 2: Attach this database into SharePoint 2013
Step 3: Upgrade the site
Result:
Everything worked correctly accept for the home page throw the error "Access denied". They show "this page is not shared with you!"
The home is inherited the custom master page and using the custom code to add the navigation to top link bar.
This is a code:
MyWeb.AllowUnsafeUpdates = true;
if (!MyWeb.IsRootWeb)
{
MyWeb.Navigation.UseShared = true;
if (!MyWeb.ParentWeb.Navigation.UseShared)
{
// Get top link bar.
SPNavigationNodeCollection topnav = MyWeb.ParentWeb.Navigation.TopNavigationBar;
serverRelativeUrl = MyWeb.ServerRelativeUrl;
// Query for an existing link.
SPNavigationNode node = topnav
.Cast<SPNavigationNode>()
.FirstOrDefault(n => n.Url.Equals(serverRelativeUrl));
// No link, so add one.
if (node == null)
{
// Truncate long a title.
string linkTitle = MyWeb.Title;
if (linkTitle.Length > 15)
linkTitle = linkTitle.Substring(0, 12) + "...";
// Create the node.
node = new SPNavigationNode(linkTitle, serverRelativeUrl);
// Add it.
node = topnav.AddAsLast(node);
}
}
}
MyWeb.AllowUnsafeUpdates = false;
You know what, the property named "MyWeb.Navigation.UseShared" is only work with Design role assignment or higher. If I logged into site by contributor, it will throw exception "Access denied".
This is error tracking:
System.Threading.ThreadAbortException: Thread was being aborted. at System.Threading.Thread.AbortInternal() at System.Threading.Thread.Abort(Object stateInfo) at System.Web.HttpResponse.AbortCurrentThread() at Microsoft.SharePoint.Utilities.SPUtility.Redirect(String url, SPRedirectFlags flags, HttpContext context, String queryString) at Microsoft.SharePoint.Utilities.SPUtility.RedirectToAccessDeniedPage(HttpContext context) at Microsoft.SharePoint.Utilities.SPUtility.HandleAccessDenied(HttpContext context) at Microsoft.SharePoint.Utilities.SPUtility.HandleAccessDenied(Exception ex) at Microsoft.SharePoint.SPSecurableObject.CheckPermissions(SPBasePermissions permissionMask) at Microsoft.SharePoint.SPSecurity.ValidateSecurityOnOperation(SPOperationCode code, SPSecurableObject obj) at Microsoft.SharePoint.SPSecurityOnOperationScope..ctor(SPOperationCode code, SPSecurableObject obj) at Microsoft.SharePoint.Navigation.SPNavigation.set_UseShared(Boolean value) at Bamboo.CommunityCentral.MasterPageBase.<AddCentralSiteToTopLinkBar>b__5() at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass5.<RunWithElevatedPrivileges>b__3() at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode) at Bamboo.CommunityCentral.MasterPageBase.AddCentralSiteToTopLinkBar() at Bamboo.CommunityCentral.MasterPageBase.OnLoad(EventArgs e)
Remember: That code cannot work under privileged delegation, thus there is one way to pass the error is to check the current user before apply the code.
Good luck to you.
Friday, July 25, 2014
Monday, July 14, 2014
[Resolved] Error: Unable to get value of the property 'showWaitScreenWithNoClose': object is null or undefined
Today, I will try to use the API with a wide library JS in SharePoint 2013. If you are familiar to JS and SharePoint Client Object Model, you will know how to call a method or execute a query using SharePoint API. However, to work with SharePoint 2013 smoothly, you must research what the SharePoint did!
In some js library, SharePoint had supported a debug file to help you learn to be acquainted with approaching API client library. And I have resolved a great of issues based on that.
My use case is: when I click on a post-back button, after the back-end processed and return the data, the page is reload and I don't want to submit as a post-back re-rendering all view state. The code looks like:
<asp:Button runat="server" Text="Process..." OnClientClick="Update()" OnClick="btn_ProcessClick"></asp:Button>
and the Js code is:
function Update() {
var dialog = SP.UI.ModalDialog.showWaitScreenWithNoClose("Waiting!", "Processing...");
}
I did not implement any remaining functions, just need to test a window dialog to ensure the dialog works fine. But the result is:
Error: Unable to get value of the property 'showWaitScreenWithNoClose': object is null or undefined
My though is all client scripts are loaded and SharePoint did by using the default master page. And that's true! However, to initialize the object or class we must ensure the script loaded into page before using. To fix this issue, the code was changed:
var fn = function() {
var dlg = SP.UI.ModalDialog.showWaitScreenWithNoClose("Waiting!", "Processing...");
};
var defd;
try {
defd = typeof SP.UI.ModalDialog.showWaitScreenWithNoClose;
}
catch (e) {
defd = "undefined";
}
EnsureScript("SP.UI.Dialog.js", defd, fn);
And the result is:
Conclusion: To work with API client SharePoint object model, we must ensure the scripts loaded!
In some js library, SharePoint had supported a debug file to help you learn to be acquainted with approaching API client library. And I have resolved a great of issues based on that.
My use case is: when I click on a post-back button, after the back-end processed and return the data, the page is reload and I don't want to submit as a post-back re-rendering all view state. The code looks like:
<asp:Button runat="server" Text="Process..." OnClientClick="Update()" OnClick="btn_ProcessClick"></asp:Button>
and the Js code is:
function Update() {
var dialog = SP.UI.ModalDialog.showWaitScreenWithNoClose("Waiting!", "Processing...");
}
I did not implement any remaining functions, just need to test a window dialog to ensure the dialog works fine. But the result is:
Error: Unable to get value of the property 'showWaitScreenWithNoClose': object is null or undefined
var fn = function() {
var dlg = SP.UI.ModalDialog.showWaitScreenWithNoClose("Waiting!", "Processing...");
};
var defd;
try {
defd = typeof SP.UI.ModalDialog.showWaitScreenWithNoClose;
}
catch (e) {
defd = "undefined";
}
EnsureScript("SP.UI.Dialog.js", defd, fn);
And the result is:
Conclusion: To work with API client SharePoint object model, we must ensure the scripts loaded!
Tuesday, April 15, 2014
Update: How to SharePoint 2013 resolve saving conflict when updating item in Discussion Board
If you are developer and try to update something in the list/site, you will get the error sometime lile this:
Save Conflict
Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes
However, SharePoint 2013 has been fixed this issue by using loop statement to save again. Try 5 times to avoid the conflict saving data.
using (new SPMonitoredScope(string.Format(CultureInfo.InvariantCulture, "HandleSaveConflict for method: {0}", new object[] { action.Method.Name }))) { int num = 0; while (num < 5) { try { action(); return; } catch (SPException exception) { ULS.SendTraceTag(0x220191, ULSCat.msoulscat_WSS_General, ULSTraceLevel.Verbose, "Save conflict in Discussion update: " + exception.Message); if ((num == 5) || !SPUtility.IsSaveConflictException(exception)) { throw; } Thread.Sleep(100); num++; continue; } } }
That's s cute and funny. But that's fine. Learn from #Microsoft #SharePoint team to update the list somehow. Like it!
Thursday, January 9, 2014
Difference between tracking list in SharePoint 2010 and 2013
SharePoint 2010 has 3 kinds of tracking list: Task, Project
Tasks and Issue Tracking. To create one of these lists, just go to Site Action
and click on More Options. It doesn’t depend on site template completely. The
following table is described details of these lists:
|
Name
|
Feature ID
|
List Template
|
|
Tasks
|
{00bfea71-a83e-497e-9ba0-7a5c597d0107}
|
107
|
|
Project Tasks
|
{00bfea71-513d-4ca0-96c2-6a47775c0119}
|
150
|
|
Issue Tracking
|
{00bfea71-5932-4f9c-ad71-1557e5751100}
|
1100
|
There is a special option in the Advance Setting: Email
Nofitication. This option is enabled if the Email Setting in Central
Administration has been configured. When this option is set to ‘Yes’, that
means the user who has been assigned to by ownership will get the alert by
email or the ownership has changed something in that item.
Before to enable Email Notification option, take a look at
Item-level Permissions options. To manage user working on the list, the
moderator could change this option to allow/disallow user who has permission to
read, edit or doing something on list item.
Assume that the user who has not permission to read the item
but was assigned by the owner. So, what will happen and how the user could see
that item? If you are still feel confused, let see the WAD of SharePoint 2013.
SharePoint 2013 has exposed much more tracking list: Tasks, Task
/w. timeline, Issue tracking and GanttTasks. GanttTasks is actually a project
tasks in SharePoint 2010 and after exposed with more Tasks /w. timeline then
this list to be the default tasks.
|
Name
|
Feature ID
|
List Template
|
|
Tasks
|
{00BFEA71-A83E-497E-9BA0-7A5C597D0107}
|
107
|
|
Tasks /w. timeline
|
{F9CE21F8-F437-4f7e-8BC6-946378C850F0}
|
171
|
|
Issue Tracking
|
{00BFEA71-5932-4F9C-AD71-1557E5751100}
|
1100
|
|
GanttTasks
|
{00BFEA71-513D-4CA0-96C2-6A47775C0119}
|
150
|
In the site contents to add a new app, SharePoint 2013 was
hidden Tasks (107) and GanttTasks (150). And except for Task with timeline
doesn’t have an option Email Notification, all the others tracking list have
this option. Thus, if you try to enable this option by programmatically, the
alert by email still doesn’t work or work incorrectly.
In sharePoint 2013, to create the hidden list, please change
the url and go:
/_layouts/15/new.aspx?FeatureId{FEATURE_ID}&ListTemplate={LIST_TPL_ID}&IsDlg=1
Where: FEATURE_ID is a feature id to work with that list,
and LIST_TPL_ID is a list template id.
Friday, January 3, 2014
Announcement: SharePoint Saturday Event 7th & resume SharePointVietNam.NET forum
SharePoint Saturday Vietnam (SPSVN) is a free community focused SharePoint event dedicated to educating and engaging members of the local technical community. SPSVN draws upon the expertise of local SharePoint IT professionals, developers, and solution architects who come to together to share their real world experiences, lessons learns, best practices, and general knowledge with other like minded individuals.
SPS VN 7th will be held on Saturday, Jan 11th, 2014. The agenda and information you will find on http://sharepointsaturday.vn
For SPS Vietnam, I was speaking at the event with some topics to help developers and administrators work with the best practice:
In 2014, I will share a lot of articles about SharePoint 2013 apps for developing with trying my best. In the community, I also try to join the SPS VN discussing about the growing SharePoint apps in VN and then resume the forum for all Vietnamese SharePointers. If you have any question or something good idea you could share in the forum. This forum is a free community and don't hesitate posting on that. I (and another people) will follow and reply as soon as possible.
SPS VN 7th will be held on Saturday, Jan 11th, 2014. The agenda and information you will find on http://sharepointsaturday.vn
Location of SPS VN 7th
For SPS Vietnam, I was speaking at the event with some topics to help developers and administrators work with the best practice:
- 1st: All about the Ribbon of SharePoint 2010
- 4st: The Best Practice SharePoint Developing
- 5th: The Best Practice SharePoint Farm Installation
- 6th: Improve performance and security with best practice for SharePoint WP/App
In 2014, I will share a lot of articles about SharePoint 2013 apps for developing with trying my best. In the community, I also try to join the SPS VN discussing about the growing SharePoint apps in VN and then resume the forum for all Vietnamese SharePointers. If you have any question or something good idea you could share in the forum. This forum is a free community and don't hesitate posting on that. I (and another people) will follow and reply as soon as possible.
Thursday, January 2, 2014
Could not run the SharePoint Wizard Configuration after install the hotfix?!
SharePoint 2013 takes so long time to install and configure the CU hotfix, it took more than 5 hours for me to install. I actually increase the RAM to 16GB but the problem is not improved and more and more longer than usual. Eventually, you do not need to install the CU hotfix for August 2013, just install March, October and December 2013. That's all. If you still feel unconvinced with the duration of installing, you could see to stop the service and run the PS command as link helping bellow:
http://blogs.msdn.com/b/russmax/archive/2013/04/01/why-sharepoint-2013-cumulative-update-takes-5-hours-to-install.aspx
Somebody thought that could be install all the hotfix then after all run the wizard configuration, of course could do something like that, but at the end the error will happen if you run the SharePoint Wizard Configuration:
Don't worry about that, just do it as your best and do not need to run the wizard as normally. Just run the command by command line:
psconfig.exe -cmd upgrade -inplace b2b -force -cmd installcheck -noinstallcheck
Here is the blog to explain about the above command:
http://blogs.msdn.com/b/fabdulwahab/archive/2013/03/04/missing-hot-fixes-sharepoint-2010-configuration-wizard.aspx
http://blogs.msdn.com/b/russmax/archive/2013/04/01/why-sharepoint-2013-cumulative-update-takes-5-hours-to-install.aspx
Somebody thought that could be install all the hotfix then after all run the wizard configuration, of course could do something like that, but at the end the error will happen if you run the SharePoint Wizard Configuration:
Don't worry about that, just do it as your best and do not need to run the wizard as normally. Just run the command by command line:
psconfig.exe -cmd upgrade -inplace b2b -force -cmd installcheck -noinstallcheck
Here is the blog to explain about the above command:
http://blogs.msdn.com/b/fabdulwahab/archive/2013/03/04/missing-hot-fixes-sharepoint-2010-configuration-wizard.aspx
Keyword:
How To,
QA,
SharePoint 2013,
SharePoint 2013 Hotfix,
Update SharePoint 2013
Monday, December 23, 2013
SharePoint Updates, Cummulative Updates and Patches: December 2013
Before to end of 2013, Microsoft has released an update for SharePoint including both Foundation and SharePoint Server.
This update fixed some issues not important and the important issue is not fixed. Performance Point is a very helpful service in SharePoint and it is very important in SharePoint 2013 environment. However, this released has been fixed many issues from another update and resolve a lot of bugs before.
To download update for SharePoint Server 2013, click here
To download update for SharePoint Foundation 2013, click here
SharePoint Designer 2013, click here
Office Web Apps, click here
To download update for SharePoint Server 2010, click here
To download update for SharePoint Foundation 2010, click here
This update fixed some issues not important and the important issue is not fixed. Performance Point is a very helpful service in SharePoint and it is very important in SharePoint 2013 environment. However, this released has been fixed many issues from another update and resolve a lot of bugs before.
To download update for SharePoint Server 2013, click here
To download update for SharePoint Foundation 2013, click here
SharePoint Designer 2013, click here
Office Web Apps, click here
To download update for SharePoint Server 2010, click here
To download update for SharePoint Foundation 2010, click here
Sunday, November 10, 2013
Add a New Language Pack to Community Central in SharePoint 2013 and 2010
The latest release of Bamboo's Community Central offers a host of new
features and customization options. One of the new features included are site
templates for different languages including German, Russian, and
Arabic. In the event that you need to have even more languages, have no
fear, for this post is here to help! In this article, we'll show you how to
build a new language for Community Central.
Some items worth noting before you begin:
http://community.bamboosolutions.com/blogs/sharepoint-2013/archive/2013/11/08/add-a-new-language-pack-to-community-central-in-sharepoint-2013-and-2010.aspx
Some items worth noting before you begin:
- In this article, we have chosen to add a language in SharePoint 2013 using the SharePoint 2013 language pack. Please note that if you are using SharePoint 2010, all steps are exactly the same.
- Bamboo Community Central has 3 templates: Community Central Home, Blog Home, and Forum Home template. In this post, we will be adding the language to a site that utilizes the Community Central Home template.
http://community.bamboosolutions.com/blogs/sharepoint-2013/archive/2013/11/08/add-a-new-language-pack-to-community-central-in-sharepoint-2013-and-2010.aspx
Tuesday, August 20, 2013
Fixed: Error CS0030: Cannot convert type DelegateControl to IAttributeAccessor
Sometime, we get the error "error CS0030: Cannot convert type
'Microsoft.SharePoint.WebControls.DelegateControl' to
'System.Web.UI.IAttributeAccessor'" when we customize the masterpage of SharePoint. Many people think that the error comes from mis-typed or SharePoint does not recognize the control with tag name <tag:Delegate> and the solution is to remove that line. Of course, it will work correctly and you could see there is no error after that.
With my solution, there is no need to delete or remove the delegate control out of master page. The error happens because the structure of HTML for delegate control is not correct and you need to review the code to make sure that the hierarchy of HTML page is right. Sometime, there are many break-lines (the empty lines or too much enter key pressed...) also to get this error.
With my solution, there is no need to delete or remove the delegate control out of master page. The error happens because the structure of HTML for delegate control is not correct and you need to review the code to make sure that the hierarchy of HTML page is right. Sometime, there are many break-lines (the empty lines or too much enter key pressed...) also to get this error.
Case Sensitive in SharePoint
I actually didn't know about some areas in SharePoint using declaration with case-sensitive until today I work on List Definition and Custom Activity.
1) When we define a new list, we must define the list of fields and their properties. Especially in the schema for field, take a look the definition schema field by MSDN:
ID: is the GUID of the field and put it into {...}
Id: is the text optional
The confusing thing is if you define the field with type is different from Lookup, you might use Id instead of ID. But if you declare the type is Lookup, you must use ID unless the feature couldn't be activated. Althought Id is the optional text but you are still able to use as ID.
2) If you code a custom activity and need it to be availabe on SharePoint Designer while you are designing a workflow, you must define the mapping type in WSS.ACTION file (you can find here C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\1033\Workflow)
The most important thing is all declarations in this file are case-sensitive and you must correct it before to use. It took me some hours to find out the error because I defined ID instead of Id in the field binding
<FieldBind Field="Error" Text="this message" Id="1" DesignerType="TextBox"/>
That's awesome!
1) When we define a new list, we must define the list of fields and their properties. Especially in the schema for field, take a look the definition schema field by MSDN:
<Field ID = "Text" Id = "Text" Type = "Data_Type" ...> </Field>Where:
ID: is the GUID of the field and put it into {...}
Id: is the text optional
The confusing thing is if you define the field with type is different from Lookup, you might use Id instead of ID. But if you declare the type is Lookup, you must use ID unless the feature couldn't be activated. Althought Id is the optional text but you are still able to use as ID.
2) If you code a custom activity and need it to be availabe on SharePoint Designer while you are designing a workflow, you must define the mapping type in WSS.ACTION file (you can find here C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\1033\Workflow)
The most important thing is all declarations in this file are case-sensitive and you must correct it before to use. It took me some hours to find out the error because I defined ID instead of Id in the field binding
<FieldBind Field="Error" Text="this message" Id="1" DesignerType="TextBox"/>
That's awesome!
Keyword:
Case-Sensitive,
List Definition,
SharePoint 2010,
SharePoint 2013,
Workflow
Subscribe to:
Posts (Atom)


